@assistant-ui/mcp-docs-server 0.1.1

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 (109) hide show
  1. package/.docs/organized/code-examples/local-ollama.md +1135 -0
  2. package/.docs/organized/code-examples/search-agent-for-e-commerce.md +1721 -0
  3. package/.docs/organized/code-examples/with-ai-sdk.md +1081 -0
  4. package/.docs/organized/code-examples/with-cloud.md +1164 -0
  5. package/.docs/organized/code-examples/with-external-store.md +1064 -0
  6. package/.docs/organized/code-examples/with-ffmpeg.md +1305 -0
  7. package/.docs/organized/code-examples/with-langgraph.md +1819 -0
  8. package/.docs/organized/code-examples/with-openai-assistants.md +1175 -0
  9. package/.docs/organized/code-examples/with-react-hook-form.md +1727 -0
  10. package/.docs/organized/code-examples/with-vercel-ai-rsc.md +1157 -0
  11. package/.docs/raw/blog/2024-07-29-hello/index.mdx +65 -0
  12. package/.docs/raw/blog/2024-09-11/index.mdx +10 -0
  13. package/.docs/raw/blog/2024-12-15/index.mdx +10 -0
  14. package/.docs/raw/blog/2025-01-31-changelog/index.mdx +129 -0
  15. package/.docs/raw/docs/about-assistantui.mdx +44 -0
  16. package/.docs/raw/docs/api-reference/context-providers/AssistantRuntimeProvider.mdx +30 -0
  17. package/.docs/raw/docs/api-reference/context-providers/TextContentPartProvider.mdx +26 -0
  18. package/.docs/raw/docs/api-reference/integrations/react-hook-form.mdx +103 -0
  19. package/.docs/raw/docs/api-reference/integrations/vercel-ai-sdk.mdx +145 -0
  20. package/.docs/raw/docs/api-reference/overview.mdx +583 -0
  21. package/.docs/raw/docs/api-reference/primitives/ActionBar.mdx +264 -0
  22. package/.docs/raw/docs/api-reference/primitives/AssistantModal.mdx +129 -0
  23. package/.docs/raw/docs/api-reference/primitives/Attachment.mdx +96 -0
  24. package/.docs/raw/docs/api-reference/primitives/BranchPicker.mdx +87 -0
  25. package/.docs/raw/docs/api-reference/primitives/Composer.mdx +204 -0
  26. package/.docs/raw/docs/api-reference/primitives/ContentPart.mdx +173 -0
  27. package/.docs/raw/docs/api-reference/primitives/Error.mdx +70 -0
  28. package/.docs/raw/docs/api-reference/primitives/Message.mdx +181 -0
  29. package/.docs/raw/docs/api-reference/primitives/Thread.mdx +197 -0
  30. package/.docs/raw/docs/api-reference/primitives/composition.mdx +21 -0
  31. package/.docs/raw/docs/api-reference/runtimes/AssistantRuntime.mdx +33 -0
  32. package/.docs/raw/docs/api-reference/runtimes/AttachmentRuntime.mdx +46 -0
  33. package/.docs/raw/docs/api-reference/runtimes/ComposerRuntime.mdx +69 -0
  34. package/.docs/raw/docs/api-reference/runtimes/ContentPartRuntime.mdx +22 -0
  35. package/.docs/raw/docs/api-reference/runtimes/MessageRuntime.mdx +49 -0
  36. package/.docs/raw/docs/api-reference/runtimes/ThreadListItemRuntime.mdx +32 -0
  37. package/.docs/raw/docs/api-reference/runtimes/ThreadListRuntime.mdx +31 -0
  38. package/.docs/raw/docs/api-reference/runtimes/ThreadRuntime.mdx +48 -0
  39. package/.docs/raw/docs/architecture.mdx +92 -0
  40. package/.docs/raw/docs/cloud/authorization.mdx +152 -0
  41. package/.docs/raw/docs/cloud/overview.mdx +55 -0
  42. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +54 -0
  43. package/.docs/raw/docs/cloud/persistence/langgraph.mdx +123 -0
  44. package/.docs/raw/docs/concepts/architecture.mdx +19 -0
  45. package/.docs/raw/docs/concepts/runtime-layer.mdx +163 -0
  46. package/.docs/raw/docs/concepts/why.mdx +9 -0
  47. package/.docs/raw/docs/copilots/make-assistant-readable.mdx +71 -0
  48. package/.docs/raw/docs/copilots/make-assistant-tool-ui.mdx +76 -0
  49. package/.docs/raw/docs/copilots/make-assistant-tool.mdx +117 -0
  50. package/.docs/raw/docs/copilots/model-context.mdx +135 -0
  51. package/.docs/raw/docs/copilots/motivation.mdx +191 -0
  52. package/.docs/raw/docs/copilots/use-assistant-instructions.mdx +62 -0
  53. package/.docs/raw/docs/getting-started.mdx +1133 -0
  54. package/.docs/raw/docs/guides/Attachments.mdx +640 -0
  55. package/.docs/raw/docs/guides/Branching.mdx +59 -0
  56. package/.docs/raw/docs/guides/Editing.mdx +56 -0
  57. package/.docs/raw/docs/guides/Speech.mdx +43 -0
  58. package/.docs/raw/docs/guides/ToolUI.mdx +663 -0
  59. package/.docs/raw/docs/guides/Tools.mdx +496 -0
  60. package/.docs/raw/docs/index.mdx +7 -0
  61. package/.docs/raw/docs/legacy/styled/AssistantModal.mdx +85 -0
  62. package/.docs/raw/docs/legacy/styled/Decomposition.mdx +633 -0
  63. package/.docs/raw/docs/legacy/styled/Markdown.mdx +86 -0
  64. package/.docs/raw/docs/legacy/styled/Scrollbar.mdx +71 -0
  65. package/.docs/raw/docs/legacy/styled/Thread.mdx +84 -0
  66. package/.docs/raw/docs/legacy/styled/ThreadWidth.mdx +21 -0
  67. package/.docs/raw/docs/mcp-docs-server.mdx +324 -0
  68. package/.docs/raw/docs/migrations/deprecation-policy.mdx +41 -0
  69. package/.docs/raw/docs/migrations/v0-7.mdx +188 -0
  70. package/.docs/raw/docs/migrations/v0-8.mdx +160 -0
  71. package/.docs/raw/docs/migrations/v0-9.mdx +75 -0
  72. package/.docs/raw/docs/react-compatibility.mdx +208 -0
  73. package/.docs/raw/docs/runtimes/ai-sdk/rsc.mdx +226 -0
  74. package/.docs/raw/docs/runtimes/ai-sdk/use-assistant-hook.mdx +195 -0
  75. package/.docs/raw/docs/runtimes/ai-sdk/use-chat-hook.mdx +138 -0
  76. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +136 -0
  77. package/.docs/raw/docs/runtimes/custom/external-store.mdx +1624 -0
  78. package/.docs/raw/docs/runtimes/custom/local.mdx +1185 -0
  79. package/.docs/raw/docs/runtimes/helicone.mdx +60 -0
  80. package/.docs/raw/docs/runtimes/langgraph/index.mdx +320 -0
  81. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +11 -0
  82. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +28 -0
  83. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +120 -0
  84. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +336 -0
  85. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +385 -0
  86. package/.docs/raw/docs/runtimes/langserve.mdx +126 -0
  87. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +218 -0
  88. package/.docs/raw/docs/runtimes/mastra/overview.mdx +17 -0
  89. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +196 -0
  90. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +222 -0
  91. package/.docs/raw/docs/ui/AssistantModal.mdx +46 -0
  92. package/.docs/raw/docs/ui/AssistantSidebar.mdx +42 -0
  93. package/.docs/raw/docs/ui/Attachment.mdx +82 -0
  94. package/.docs/raw/docs/ui/Markdown.mdx +72 -0
  95. package/.docs/raw/docs/ui/Mermaid.mdx +79 -0
  96. package/.docs/raw/docs/ui/Scrollbar.mdx +59 -0
  97. package/.docs/raw/docs/ui/SyntaxHighlighting.mdx +253 -0
  98. package/.docs/raw/docs/ui/Thread.mdx +47 -0
  99. package/.docs/raw/docs/ui/ThreadList.mdx +49 -0
  100. package/.docs/raw/docs/ui/ToolFallback.mdx +64 -0
  101. package/.docs/raw/docs/ui/primitives/Thread.mdx +197 -0
  102. package/LICENSE +21 -0
  103. package/README.md +128 -0
  104. package/dist/chunk-C7O7EFKU.js +38 -0
  105. package/dist/chunk-CZCDQ3YH.js +420 -0
  106. package/dist/index.js +1 -0
  107. package/dist/prepare-docs/prepare.js +199 -0
  108. package/dist/stdio.js +8 -0
  109. package/package.json +43 -0
@@ -0,0 +1,1164 @@
1
+ # Example: with-cloud
2
+
3
+ ## app/api/chat/route.ts
4
+
5
+ ```typescript
6
+ import { openai } from "@ai-sdk/openai";
7
+ import { jsonSchema, streamText } from "ai";
8
+
9
+ export const runtime = "edge";
10
+ export const maxDuration = 30;
11
+
12
+ export async function POST(req: Request) {
13
+ const { messages, system, tools } = await req.json();
14
+
15
+ const result = streamText({
16
+ model: openai("gpt-4o"),
17
+ messages,
18
+ // forward system prompt and tools from the frontend
19
+ system,
20
+ tools:
21
+ tools &&
22
+ Object.fromEntries(
23
+ Object.entries<{ parameters: unknown }>(tools).map(([name, tool]) => [
24
+ name,
25
+ {
26
+ parameters: jsonSchema(tool.parameters!),
27
+ },
28
+ ]),
29
+ ),
30
+ });
31
+
32
+ return result.toDataStreamResponse();
33
+ }
34
+
35
+ ```
36
+
37
+ ## app/globals.css
38
+
39
+ ```css
40
+ @import "tailwindcss";
41
+ @import "tw-animate-css";
42
+
43
+ @custom-variant dark (&:is(.dark *));
44
+
45
+ @theme inline {
46
+ --color-background: var(--background);
47
+ --color-foreground: var(--foreground);
48
+ --font-sans: var(--font-geist-sans);
49
+ --font-mono: var(--font-geist-mono);
50
+ --color-sidebar-ring: var(--sidebar-ring);
51
+ --color-sidebar-border: var(--sidebar-border);
52
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
53
+ --color-sidebar-accent: var(--sidebar-accent);
54
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
55
+ --color-sidebar-primary: var(--sidebar-primary);
56
+ --color-sidebar-foreground: var(--sidebar-foreground);
57
+ --color-sidebar: var(--sidebar);
58
+ --color-chart-5: var(--chart-5);
59
+ --color-chart-4: var(--chart-4);
60
+ --color-chart-3: var(--chart-3);
61
+ --color-chart-2: var(--chart-2);
62
+ --color-chart-1: var(--chart-1);
63
+ --color-ring: var(--ring);
64
+ --color-input: var(--input);
65
+ --color-border: var(--border);
66
+ --color-destructive: var(--destructive);
67
+ --color-accent-foreground: var(--accent-foreground);
68
+ --color-accent: var(--accent);
69
+ --color-muted-foreground: var(--muted-foreground);
70
+ --color-muted: var(--muted);
71
+ --color-secondary-foreground: var(--secondary-foreground);
72
+ --color-secondary: var(--secondary);
73
+ --color-primary-foreground: var(--primary-foreground);
74
+ --color-primary: var(--primary);
75
+ --color-popover-foreground: var(--popover-foreground);
76
+ --color-popover: var(--popover);
77
+ --color-card-foreground: var(--card-foreground);
78
+ --color-card: var(--card);
79
+ --radius-sm: calc(var(--radius) - 4px);
80
+ --radius-md: calc(var(--radius) - 2px);
81
+ --radius-lg: var(--radius);
82
+ --radius-xl: calc(var(--radius) + 4px);
83
+ }
84
+
85
+ :root {
86
+ --radius: 0.625rem;
87
+ --background: oklch(1 0 0);
88
+ --foreground: oklch(0.141 0.005 285.823);
89
+ --card: oklch(1 0 0);
90
+ --card-foreground: oklch(0.141 0.005 285.823);
91
+ --popover: oklch(1 0 0);
92
+ --popover-foreground: oklch(0.141 0.005 285.823);
93
+ --primary: oklch(0.21 0.006 285.885);
94
+ --primary-foreground: oklch(0.985 0 0);
95
+ --secondary: oklch(0.967 0.001 286.375);
96
+ --secondary-foreground: oklch(0.21 0.006 285.885);
97
+ --muted: oklch(0.967 0.001 286.375);
98
+ --muted-foreground: oklch(0.552 0.016 285.938);
99
+ --accent: oklch(0.967 0.001 286.375);
100
+ --accent-foreground: oklch(0.21 0.006 285.885);
101
+ --destructive: oklch(0.577 0.245 27.325);
102
+ --border: oklch(0.92 0.004 286.32);
103
+ --input: oklch(0.92 0.004 286.32);
104
+ --ring: oklch(0.705 0.015 286.067);
105
+ --chart-1: oklch(0.646 0.222 41.116);
106
+ --chart-2: oklch(0.6 0.118 184.704);
107
+ --chart-3: oklch(0.398 0.07 227.392);
108
+ --chart-4: oklch(0.828 0.189 84.429);
109
+ --chart-5: oklch(0.769 0.188 70.08);
110
+ --sidebar: oklch(0.985 0 0);
111
+ --sidebar-foreground: oklch(0.141 0.005 285.823);
112
+ --sidebar-primary: oklch(0.21 0.006 285.885);
113
+ --sidebar-primary-foreground: oklch(0.985 0 0);
114
+ --sidebar-accent: oklch(0.967 0.001 286.375);
115
+ --sidebar-accent-foreground: oklch(0.21 0.006 285.885);
116
+ --sidebar-border: oklch(0.92 0.004 286.32);
117
+ --sidebar-ring: oklch(0.705 0.015 286.067);
118
+ }
119
+
120
+ .dark {
121
+ --background: oklch(0.141 0.005 285.823);
122
+ --foreground: oklch(0.985 0 0);
123
+ --card: oklch(0.21 0.006 285.885);
124
+ --card-foreground: oklch(0.985 0 0);
125
+ --popover: oklch(0.21 0.006 285.885);
126
+ --popover-foreground: oklch(0.985 0 0);
127
+ --primary: oklch(0.92 0.004 286.32);
128
+ --primary-foreground: oklch(0.21 0.006 285.885);
129
+ --secondary: oklch(0.274 0.006 286.033);
130
+ --secondary-foreground: oklch(0.985 0 0);
131
+ --muted: oklch(0.274 0.006 286.033);
132
+ --muted-foreground: oklch(0.705 0.015 286.067);
133
+ --accent: oklch(0.274 0.006 286.033);
134
+ --accent-foreground: oklch(0.985 0 0);
135
+ --destructive: oklch(0.704 0.191 22.216);
136
+ --border: oklch(1 0 0 / 10%);
137
+ --input: oklch(1 0 0 / 15%);
138
+ --ring: oklch(0.552 0.016 285.938);
139
+ --chart-1: oklch(0.488 0.243 264.376);
140
+ --chart-2: oklch(0.696 0.17 162.48);
141
+ --chart-3: oklch(0.769 0.188 70.08);
142
+ --chart-4: oklch(0.627 0.265 303.9);
143
+ --chart-5: oklch(0.645 0.246 16.439);
144
+ --sidebar: oklch(0.21 0.006 285.885);
145
+ --sidebar-foreground: oklch(0.985 0 0);
146
+ --sidebar-primary: oklch(0.488 0.243 264.376);
147
+ --sidebar-primary-foreground: oklch(0.985 0 0);
148
+ --sidebar-accent: oklch(0.274 0.006 286.033);
149
+ --sidebar-accent-foreground: oklch(0.985 0 0);
150
+ --sidebar-border: oklch(1 0 0 / 10%);
151
+ --sidebar-ring: oklch(0.552 0.016 285.938);
152
+ }
153
+
154
+ @layer base {
155
+ * {
156
+ @apply border-border outline-ring/50;
157
+ }
158
+ body {
159
+ @apply bg-background text-foreground;
160
+ }
161
+ }
162
+
163
+ ```
164
+
165
+ ## app/layout.tsx
166
+
167
+ ```tsx
168
+ import type { Metadata } from "next";
169
+ import { Geist, Geist_Mono } from "next/font/google";
170
+ import { MyRuntimeProvider } from "@/app/MyRuntimeProvider";
171
+
172
+ import "./globals.css";
173
+
174
+ const geistSans = Geist({
175
+ variable: "--font-geist-sans",
176
+ subsets: ["latin"],
177
+ });
178
+
179
+ const geistMono = Geist_Mono({
180
+ variable: "--font-geist-mono",
181
+ subsets: ["latin"],
182
+ });
183
+
184
+ export const metadata: Metadata = {
185
+ title: "Assistant Cloud Example",
186
+ description: "Example showcasing assistant-cloud thread history integration",
187
+ };
188
+
189
+ export default function RootLayout({
190
+ children,
191
+ }: Readonly<{
192
+ children: React.ReactNode;
193
+ }>) {
194
+ return (
195
+ <html lang="en" className="h-dvh">
196
+ <body
197
+ className={`${geistSans.variable} ${geistMono.variable} h-dvh antialiased`}
198
+ >
199
+ <MyRuntimeProvider>{children}</MyRuntimeProvider>
200
+ </body>
201
+ </html>
202
+ );
203
+ }
204
+
205
+ ```
206
+
207
+ ## app/MyRuntimeProvider.tsx
208
+
209
+ ```tsx
210
+ "use client";
211
+
212
+ import { AssistantCloud, AssistantRuntimeProvider } from "@assistant-ui/react";
213
+ import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
214
+
215
+ const cloud = new AssistantCloud({
216
+ baseUrl: process.env["NEXT_PUBLIC_ASSISTANT_BASE_URL"]!,
217
+ anonymous: true,
218
+ });
219
+
220
+ export function MyRuntimeProvider({
221
+ children,
222
+ }: Readonly<{
223
+ children: React.ReactNode;
224
+ }>) {
225
+ const runtime = useChatRuntime({
226
+ cloud,
227
+ api: "/api/chat",
228
+ });
229
+
230
+ return (
231
+ <AssistantRuntimeProvider runtime={runtime}>
232
+ {children}
233
+ </AssistantRuntimeProvider>
234
+ );
235
+ }
236
+
237
+ ```
238
+
239
+ ## app/page.tsx
240
+
241
+ ```tsx
242
+ "use client";
243
+
244
+ import { Thread } from "@/components/assistant-ui/thread";
245
+ import { ThreadList } from "@/components/assistant-ui/thread-list";
246
+
247
+ export default function Home() {
248
+ return (
249
+ <main className="grid h-dvh grid-cols-[200px,1fr] gap-4 p-4">
250
+ <ThreadList />
251
+ <Thread />
252
+ </main>
253
+ );
254
+ }
255
+
256
+ ```
257
+
258
+ ## components.json
259
+
260
+ ```json
261
+ {
262
+ "$schema": "https://ui.shadcn.com/schema.json",
263
+ "style": "new-york",
264
+ "rsc": true,
265
+ "tsx": true,
266
+ "tailwind": {
267
+ "config": "tailwind.config.ts",
268
+ "css": "app/globals.css",
269
+ "baseColor": "zinc",
270
+ "cssVariables": true,
271
+ "prefix": ""
272
+ },
273
+ "aliases": {
274
+ "components": "@/components",
275
+ "utils": "@/lib/utils",
276
+ "ui": "@/components/ui",
277
+ "lib": "@/lib",
278
+ "hooks": "@/hooks"
279
+ },
280
+ "iconLibrary": "lucide"
281
+ }
282
+ ```
283
+
284
+ ## components/assistant-ui/markdown-text.tsx
285
+
286
+ ```tsx
287
+ "use client";
288
+
289
+ import "@assistant-ui/react-markdown/styles/dot.css";
290
+
291
+ import {
292
+ CodeHeaderProps,
293
+ MarkdownTextPrimitive,
294
+ unstable_memoizeMarkdownComponents as memoizeMarkdownComponents,
295
+ useIsMarkdownCodeBlock,
296
+ } from "@assistant-ui/react-markdown";
297
+ import remarkGfm from "remark-gfm";
298
+ import { FC, memo, useState } from "react";
299
+ import { CheckIcon, CopyIcon } from "lucide-react";
300
+
301
+ import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
302
+ import { cn } from "@/lib/utils";
303
+
304
+ const MarkdownTextImpl = () => {
305
+ return (
306
+ <MarkdownTextPrimitive
307
+ remarkPlugins={[remarkGfm]}
308
+ className="aui-md"
309
+ components={defaultComponents}
310
+ />
311
+ );
312
+ };
313
+
314
+ export const MarkdownText = memo(MarkdownTextImpl);
315
+
316
+ const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {
317
+ const { isCopied, copyToClipboard } = useCopyToClipboard();
318
+ const onCopy = () => {
319
+ if (!code || isCopied) return;
320
+ copyToClipboard(code);
321
+ };
322
+
323
+ return (
324
+ <div className="flex items-center justify-between gap-4 rounded-t-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white">
325
+ <span className="lowercase [&>span]:text-xs">{language}</span>
326
+ <TooltipIconButton tooltip="Copy" onClick={onCopy}>
327
+ {!isCopied && <CopyIcon />}
328
+ {isCopied && <CheckIcon />}
329
+ </TooltipIconButton>
330
+ </div>
331
+ );
332
+ };
333
+
334
+ const useCopyToClipboard = ({
335
+ copiedDuration = 3000,
336
+ }: {
337
+ copiedDuration?: number;
338
+ } = {}) => {
339
+ const [isCopied, setIsCopied] = useState<boolean>(false);
340
+
341
+ const copyToClipboard = (value: string) => {
342
+ if (!value) return;
343
+
344
+ navigator.clipboard.writeText(value).then(() => {
345
+ setIsCopied(true);
346
+ setTimeout(() => setIsCopied(false), copiedDuration);
347
+ });
348
+ };
349
+
350
+ return { isCopied, copyToClipboard };
351
+ };
352
+
353
+ const defaultComponents = memoizeMarkdownComponents({
354
+ h1: ({ className, ...props }) => (
355
+ <h1
356
+ className={cn(
357
+ "mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",
358
+ className,
359
+ )}
360
+ {...props}
361
+ />
362
+ ),
363
+ h2: ({ className, ...props }) => (
364
+ <h2
365
+ className={cn(
366
+ "mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",
367
+ className,
368
+ )}
369
+ {...props}
370
+ />
371
+ ),
372
+ h3: ({ className, ...props }) => (
373
+ <h3
374
+ className={cn(
375
+ "mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",
376
+ className,
377
+ )}
378
+ {...props}
379
+ />
380
+ ),
381
+ h4: ({ className, ...props }) => (
382
+ <h4
383
+ className={cn(
384
+ "mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",
385
+ className,
386
+ )}
387
+ {...props}
388
+ />
389
+ ),
390
+ h5: ({ className, ...props }) => (
391
+ <h5
392
+ className={cn(
393
+ "my-4 text-lg font-semibold first:mt-0 last:mb-0",
394
+ className,
395
+ )}
396
+ {...props}
397
+ />
398
+ ),
399
+ h6: ({ className, ...props }) => (
400
+ <h6
401
+ className={cn("my-4 font-semibold first:mt-0 last:mb-0", className)}
402
+ {...props}
403
+ />
404
+ ),
405
+ p: ({ className, ...props }) => (
406
+ <p
407
+ className={cn("mb-5 mt-5 leading-7 first:mt-0 last:mb-0", className)}
408
+ {...props}
409
+ />
410
+ ),
411
+ a: ({ className, ...props }) => (
412
+ <a
413
+ className={cn(
414
+ "text-primary font-medium underline underline-offset-4",
415
+ className,
416
+ )}
417
+ {...props}
418
+ />
419
+ ),
420
+ blockquote: ({ className, ...props }) => (
421
+ <blockquote
422
+ className={cn("border-l-2 pl-6 italic", className)}
423
+ {...props}
424
+ />
425
+ ),
426
+ ul: ({ className, ...props }) => (
427
+ <ul
428
+ className={cn("my-5 ml-6 list-disc [&>li]:mt-2", className)}
429
+ {...props}
430
+ />
431
+ ),
432
+ ol: ({ className, ...props }) => (
433
+ <ol
434
+ className={cn("my-5 ml-6 list-decimal [&>li]:mt-2", className)}
435
+ {...props}
436
+ />
437
+ ),
438
+ hr: ({ className, ...props }) => (
439
+ <hr className={cn("my-5 border-b", className)} {...props} />
440
+ ),
441
+ table: ({ className, ...props }) => (
442
+ <table
443
+ className={cn(
444
+ "my-5 w-full border-separate border-spacing-0 overflow-y-auto",
445
+ className,
446
+ )}
447
+ {...props}
448
+ />
449
+ ),
450
+ th: ({ className, ...props }) => (
451
+ <th
452
+ className={cn(
453
+ "bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right",
454
+ className,
455
+ )}
456
+ {...props}
457
+ />
458
+ ),
459
+ td: ({ className, ...props }) => (
460
+ <td
461
+ className={cn(
462
+ "border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right",
463
+ className,
464
+ )}
465
+ {...props}
466
+ />
467
+ ),
468
+ tr: ({ className, ...props }) => (
469
+ <tr
470
+ className={cn(
471
+ "m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",
472
+ className,
473
+ )}
474
+ {...props}
475
+ />
476
+ ),
477
+ sup: ({ className, ...props }) => (
478
+ <sup
479
+ className={cn("[&>a]:text-xs [&>a]:no-underline", className)}
480
+ {...props}
481
+ />
482
+ ),
483
+ pre: ({ className, ...props }) => (
484
+ <pre
485
+ className={cn(
486
+ "overflow-x-auto rounded-b-lg bg-black p-4 text-white",
487
+ className,
488
+ )}
489
+ {...props}
490
+ />
491
+ ),
492
+ code: function Code({ className, ...props }) {
493
+ const isCodeBlock = useIsMarkdownCodeBlock();
494
+ return (
495
+ <code
496
+ className={cn(
497
+ !isCodeBlock && "bg-muted rounded border font-semibold",
498
+ className,
499
+ )}
500
+ {...props}
501
+ />
502
+ );
503
+ },
504
+ CodeHeader,
505
+ });
506
+
507
+ ```
508
+
509
+ ## components/assistant-ui/thread-list.tsx
510
+
511
+ ```tsx
512
+ import type { FC } from "react";
513
+ import {
514
+ ThreadListItemPrimitive,
515
+ ThreadListPrimitive,
516
+ } from "@assistant-ui/react";
517
+ import { ArchiveIcon, PlusIcon } from "lucide-react";
518
+
519
+ import { Button } from "@/components/ui/button";
520
+ import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
521
+
522
+ export const ThreadList: FC = () => {
523
+ return (
524
+ <ThreadListPrimitive.Root className="flex flex-col items-stretch gap-1.5">
525
+ <ThreadListNew />
526
+ <ThreadListItems />
527
+ </ThreadListPrimitive.Root>
528
+ );
529
+ };
530
+
531
+ const ThreadListNew: FC = () => {
532
+ return (
533
+ <ThreadListPrimitive.New asChild>
534
+ <Button
535
+ className="data-[active]:bg-muted hover:bg-muted flex items-center justify-start gap-1 rounded-lg px-2.5 py-2 text-start"
536
+ variant="ghost"
537
+ >
538
+ <PlusIcon />
539
+ New Thread
540
+ </Button>
541
+ </ThreadListPrimitive.New>
542
+ );
543
+ };
544
+
545
+ const ThreadListItems: FC = () => {
546
+ return <ThreadListPrimitive.Items components={{ ThreadListItem }} />;
547
+ };
548
+
549
+ const ThreadListItem: FC = () => {
550
+ return (
551
+ <ThreadListItemPrimitive.Root className="data-[active]:bg-muted hover:bg-muted focus-visible:bg-muted focus-visible:ring-ring flex items-center gap-2 rounded-lg transition-all focus-visible:outline-none focus-visible:ring-2">
552
+ <ThreadListItemPrimitive.Trigger className="flex-grow px-3 py-2 text-start">
553
+ <ThreadListItemTitle />
554
+ </ThreadListItemPrimitive.Trigger>
555
+ <ThreadListItemArchive />
556
+ </ThreadListItemPrimitive.Root>
557
+ );
558
+ };
559
+
560
+ const ThreadListItemTitle: FC = () => {
561
+ return (
562
+ <p className="text-sm">
563
+ <ThreadListItemPrimitive.Title fallback="New Chat" />
564
+ </p>
565
+ );
566
+ };
567
+
568
+ const ThreadListItemArchive: FC = () => {
569
+ return (
570
+ <ThreadListItemPrimitive.Archive asChild>
571
+ <TooltipIconButton
572
+ className="hover:text-primary text-foreground ml-auto mr-3 size-4 p-0"
573
+ variant="ghost"
574
+ tooltip="Archive thread"
575
+ >
576
+ <ArchiveIcon />
577
+ </TooltipIconButton>
578
+ </ThreadListItemPrimitive.Archive>
579
+ );
580
+ };
581
+
582
+ ```
583
+
584
+ ## components/assistant-ui/thread.tsx
585
+
586
+ ```tsx
587
+ import {
588
+ ActionBarPrimitive,
589
+ BranchPickerPrimitive,
590
+ ComposerPrimitive,
591
+ MessagePrimitive,
592
+ ThreadPrimitive,
593
+ } from "@assistant-ui/react";
594
+ import type { FC } from "react";
595
+ import {
596
+ ArrowDownIcon,
597
+ CheckIcon,
598
+ ChevronLeftIcon,
599
+ ChevronRightIcon,
600
+ CopyIcon,
601
+ PencilIcon,
602
+ RefreshCwIcon,
603
+ SendHorizontalIcon,
604
+ } from "lucide-react";
605
+ import { cn } from "@/lib/utils";
606
+
607
+ import { Button } from "@/components/ui/button";
608
+ import { MarkdownText } from "@/components/assistant-ui/markdown-text";
609
+ import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
610
+
611
+ export const Thread: FC = () => {
612
+ return (
613
+ <ThreadPrimitive.Root
614
+ className="bg-background box-border flex h-full flex-col overflow-hidden"
615
+ style={{
616
+ ["--thread-max-width" as string]: "42rem",
617
+ }}
618
+ >
619
+ <ThreadPrimitive.Viewport className="flex h-full flex-col items-center overflow-y-scroll scroll-smooth bg-inherit px-4 pt-8">
620
+ <ThreadWelcome />
621
+
622
+ <ThreadPrimitive.Messages
623
+ components={{
624
+ UserMessage: UserMessage,
625
+ EditComposer: EditComposer,
626
+ AssistantMessage: AssistantMessage,
627
+ }}
628
+ />
629
+
630
+ <ThreadPrimitive.If empty={false}>
631
+ <div className="min-h-8 flex-grow" />
632
+ </ThreadPrimitive.If>
633
+
634
+ <div className="sticky bottom-0 mt-3 flex w-full max-w-[var(--thread-max-width)] flex-col items-center justify-end rounded-t-lg bg-inherit pb-4">
635
+ <ThreadScrollToBottom />
636
+ <Composer />
637
+ </div>
638
+ </ThreadPrimitive.Viewport>
639
+ </ThreadPrimitive.Root>
640
+ );
641
+ };
642
+
643
+ const ThreadScrollToBottom: FC = () => {
644
+ return (
645
+ <ThreadPrimitive.ScrollToBottom asChild>
646
+ <TooltipIconButton
647
+ tooltip="Scroll to bottom"
648
+ variant="outline"
649
+ className="absolute -top-8 rounded-full disabled:invisible"
650
+ >
651
+ <ArrowDownIcon />
652
+ </TooltipIconButton>
653
+ </ThreadPrimitive.ScrollToBottom>
654
+ );
655
+ };
656
+
657
+ const ThreadWelcome: FC = () => {
658
+ return (
659
+ <ThreadPrimitive.Empty>
660
+ <div className="flex w-full max-w-[var(--thread-max-width)] flex-grow flex-col">
661
+ <div className="flex w-full flex-grow flex-col items-center justify-center">
662
+ <p className="mt-4 font-medium">How can I help you today?</p>
663
+ </div>
664
+ <ThreadWelcomeSuggestions />
665
+ </div>
666
+ </ThreadPrimitive.Empty>
667
+ );
668
+ };
669
+
670
+ const ThreadWelcomeSuggestions: FC = () => {
671
+ return (
672
+ <div className="mt-3 flex w-full items-stretch justify-center gap-4">
673
+ <ThreadPrimitive.Suggestion
674
+ className="hover:bg-muted/80 flex max-w-sm grow basis-0 flex-col items-center justify-center rounded-lg border p-3 transition-colors ease-in"
675
+ prompt="What is the weather in Tokyo?"
676
+ method="replace"
677
+ autoSend
678
+ >
679
+ <span className="line-clamp-2 text-ellipsis text-sm font-semibold">
680
+ What is the weather in Tokyo?
681
+ </span>
682
+ </ThreadPrimitive.Suggestion>
683
+ <ThreadPrimitive.Suggestion
684
+ className="hover:bg-muted/80 flex max-w-sm grow basis-0 flex-col items-center justify-center rounded-lg border p-3 transition-colors ease-in"
685
+ prompt="What is assistant-ui?"
686
+ method="replace"
687
+ autoSend
688
+ >
689
+ <span className="line-clamp-2 text-ellipsis text-sm font-semibold">
690
+ What is assistant-ui?
691
+ </span>
692
+ </ThreadPrimitive.Suggestion>
693
+ </div>
694
+ );
695
+ };
696
+
697
+ const Composer: FC = () => {
698
+ return (
699
+ <ComposerPrimitive.Root className="focus-within:border-ring/20 flex w-full flex-wrap items-end rounded-lg border bg-inherit px-2.5 shadow-sm transition-colors ease-in">
700
+ <ComposerPrimitive.Input
701
+ rows={1}
702
+ autoFocus
703
+ placeholder="Write a message..."
704
+ className="placeholder:text-muted-foreground max-h-40 flex-grow resize-none border-none bg-transparent px-2 py-4 text-sm outline-none focus:ring-0 disabled:cursor-not-allowed"
705
+ />
706
+ <ComposerAction />
707
+ </ComposerPrimitive.Root>
708
+ );
709
+ };
710
+
711
+ const ComposerAction: FC = () => {
712
+ return (
713
+ <>
714
+ <ThreadPrimitive.If running={false}>
715
+ <ComposerPrimitive.Send asChild>
716
+ <TooltipIconButton
717
+ tooltip="Send"
718
+ variant="default"
719
+ className="my-2.5 size-8 p-2 transition-opacity ease-in"
720
+ >
721
+ <SendHorizontalIcon />
722
+ </TooltipIconButton>
723
+ </ComposerPrimitive.Send>
724
+ </ThreadPrimitive.If>
725
+ <ThreadPrimitive.If running>
726
+ <ComposerPrimitive.Cancel asChild>
727
+ <TooltipIconButton
728
+ tooltip="Cancel"
729
+ variant="default"
730
+ className="my-2.5 size-8 p-2 transition-opacity ease-in"
731
+ >
732
+ <CircleStopIcon />
733
+ </TooltipIconButton>
734
+ </ComposerPrimitive.Cancel>
735
+ </ThreadPrimitive.If>
736
+ </>
737
+ );
738
+ };
739
+
740
+ const UserMessage: FC = () => {
741
+ return (
742
+ <MessagePrimitive.Root className="grid w-full max-w-[var(--thread-max-width)] auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 py-4 [&:where(>*)]:col-start-2">
743
+ <UserActionBar />
744
+
745
+ <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">
746
+ <MessagePrimitive.Content />
747
+ </div>
748
+
749
+ <BranchPicker className="col-span-full col-start-1 row-start-3 -mr-1 justify-end" />
750
+ </MessagePrimitive.Root>
751
+ );
752
+ };
753
+
754
+ const UserActionBar: FC = () => {
755
+ return (
756
+ <ActionBarPrimitive.Root
757
+ hideWhenRunning
758
+ autohide="not-last"
759
+ className="col-start-1 row-start-2 mr-3 mt-2.5 flex flex-col items-end"
760
+ >
761
+ <ActionBarPrimitive.Edit asChild>
762
+ <TooltipIconButton tooltip="Edit">
763
+ <PencilIcon />
764
+ </TooltipIconButton>
765
+ </ActionBarPrimitive.Edit>
766
+ </ActionBarPrimitive.Root>
767
+ );
768
+ };
769
+
770
+ const EditComposer: FC = () => {
771
+ return (
772
+ <ComposerPrimitive.Root className="bg-muted my-4 flex w-full max-w-[var(--thread-max-width)] flex-col gap-2 rounded-xl">
773
+ <ComposerPrimitive.Input className="text-foreground flex h-8 w-full resize-none bg-transparent p-4 pb-0 outline-none" />
774
+
775
+ <div className="mx-3 mb-3 flex items-center justify-center gap-2 self-end">
776
+ <ComposerPrimitive.Cancel asChild>
777
+ <Button variant="ghost">Cancel</Button>
778
+ </ComposerPrimitive.Cancel>
779
+ <ComposerPrimitive.Send asChild>
780
+ <Button>Send</Button>
781
+ </ComposerPrimitive.Send>
782
+ </div>
783
+ </ComposerPrimitive.Root>
784
+ );
785
+ };
786
+
787
+ const AssistantMessage: FC = () => {
788
+ return (
789
+ <MessagePrimitive.Root className="relative grid w-full max-w-[var(--thread-max-width)] grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr] py-4">
790
+ <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">
791
+ <MessagePrimitive.Content components={{ Text: MarkdownText }} />
792
+ </div>
793
+
794
+ <AssistantActionBar />
795
+
796
+ <BranchPicker className="col-start-2 row-start-2 -ml-2 mr-2" />
797
+ </MessagePrimitive.Root>
798
+ );
799
+ };
800
+
801
+ const AssistantActionBar: FC = () => {
802
+ return (
803
+ <ActionBarPrimitive.Root
804
+ hideWhenRunning
805
+ autohide="not-last"
806
+ autohideFloat="single-branch"
807
+ className="text-muted-foreground data-[floating]:bg-background col-start-3 row-start-2 -ml-1 flex gap-1 data-[floating]:absolute data-[floating]:rounded-md data-[floating]:border data-[floating]:p-1 data-[floating]:shadow-sm"
808
+ >
809
+ <ActionBarPrimitive.Copy asChild>
810
+ <TooltipIconButton tooltip="Copy">
811
+ <MessagePrimitive.If copied>
812
+ <CheckIcon />
813
+ </MessagePrimitive.If>
814
+ <MessagePrimitive.If copied={false}>
815
+ <CopyIcon />
816
+ </MessagePrimitive.If>
817
+ </TooltipIconButton>
818
+ </ActionBarPrimitive.Copy>
819
+ <ActionBarPrimitive.Reload asChild>
820
+ <TooltipIconButton tooltip="Refresh">
821
+ <RefreshCwIcon />
822
+ </TooltipIconButton>
823
+ </ActionBarPrimitive.Reload>
824
+ </ActionBarPrimitive.Root>
825
+ );
826
+ };
827
+
828
+ const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
829
+ className,
830
+ ...rest
831
+ }) => {
832
+ return (
833
+ <BranchPickerPrimitive.Root
834
+ hideWhenSingleBranch
835
+ className={cn(
836
+ "text-muted-foreground inline-flex items-center text-xs",
837
+ className,
838
+ )}
839
+ {...rest}
840
+ >
841
+ <BranchPickerPrimitive.Previous asChild>
842
+ <TooltipIconButton tooltip="Previous">
843
+ <ChevronLeftIcon />
844
+ </TooltipIconButton>
845
+ </BranchPickerPrimitive.Previous>
846
+ <span className="font-medium">
847
+ <BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />
848
+ </span>
849
+ <BranchPickerPrimitive.Next asChild>
850
+ <TooltipIconButton tooltip="Next">
851
+ <ChevronRightIcon />
852
+ </TooltipIconButton>
853
+ </BranchPickerPrimitive.Next>
854
+ </BranchPickerPrimitive.Root>
855
+ );
856
+ };
857
+
858
+ const CircleStopIcon = () => {
859
+ return (
860
+ <svg
861
+ xmlns="http://www.w3.org/2000/svg"
862
+ viewBox="0 0 16 16"
863
+ fill="currentColor"
864
+ width="16"
865
+ height="16"
866
+ >
867
+ <rect width="10" height="10" x="3" y="3" rx="2" />
868
+ </svg>
869
+ );
870
+ };
871
+
872
+ ```
873
+
874
+ ## components/assistant-ui/tooltip-icon-button.tsx
875
+
876
+ ```tsx
877
+ "use client";
878
+
879
+ import { ComponentPropsWithoutRef, forwardRef } from "react";
880
+
881
+ import {
882
+ Tooltip,
883
+ TooltipContent,
884
+ TooltipTrigger,
885
+ } from "@/components/ui/tooltip";
886
+ import { Button } from "@/components/ui/button";
887
+ import { cn } from "@/lib/utils";
888
+
889
+ export type TooltipIconButtonProps = ComponentPropsWithoutRef<typeof Button> & {
890
+ tooltip: string;
891
+ side?: "top" | "bottom" | "left" | "right";
892
+ };
893
+
894
+ export const TooltipIconButton = forwardRef<
895
+ HTMLButtonElement,
896
+ TooltipIconButtonProps
897
+ >(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
898
+ return (
899
+ <Tooltip>
900
+ <TooltipTrigger asChild>
901
+ <Button
902
+ variant="ghost"
903
+ size="icon"
904
+ {...rest}
905
+ className={cn("size-6 p-1", className)}
906
+ ref={ref}
907
+ >
908
+ {children}
909
+ <span className="sr-only">{tooltip}</span>
910
+ </Button>
911
+ </TooltipTrigger>
912
+ <TooltipContent side={side}>{tooltip}</TooltipContent>
913
+ </Tooltip>
914
+ );
915
+ });
916
+
917
+ TooltipIconButton.displayName = "TooltipIconButton";
918
+
919
+ ```
920
+
921
+ ## components/ui/button.tsx
922
+
923
+ ```tsx
924
+ import * as React from "react";
925
+ import { Slot } from "@radix-ui/react-slot";
926
+ import { cva, type VariantProps } from "class-variance-authority";
927
+
928
+ import { cn } from "@/lib/utils";
929
+
930
+ const buttonVariants = cva(
931
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
932
+ {
933
+ variants: {
934
+ variant: {
935
+ default:
936
+ "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
937
+ destructive:
938
+ "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
939
+ outline:
940
+ "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
941
+ secondary:
942
+ "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
943
+ ghost:
944
+ "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
945
+ link: "text-primary underline-offset-4 hover:underline",
946
+ },
947
+ size: {
948
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
949
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
950
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
951
+ icon: "size-9",
952
+ },
953
+ },
954
+ defaultVariants: {
955
+ variant: "default",
956
+ size: "default",
957
+ },
958
+ },
959
+ );
960
+
961
+ function Button({
962
+ className,
963
+ variant,
964
+ size,
965
+ asChild = false,
966
+ ...props
967
+ }: React.ComponentProps<"button"> &
968
+ VariantProps<typeof buttonVariants> & {
969
+ asChild?: boolean;
970
+ }) {
971
+ const Comp = asChild ? Slot : "button";
972
+
973
+ return (
974
+ <Comp
975
+ data-slot="button"
976
+ className={cn(buttonVariants({ variant, size, className }))}
977
+ {...props}
978
+ />
979
+ );
980
+ }
981
+
982
+ export { Button, buttonVariants };
983
+
984
+ ```
985
+
986
+ ## components/ui/tooltip.tsx
987
+
988
+ ```tsx
989
+ "use client";
990
+
991
+ import * as React from "react";
992
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
993
+
994
+ import { cn } from "@/lib/utils";
995
+
996
+ function TooltipProvider({
997
+ delayDuration = 0,
998
+ ...props
999
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
1000
+ return (
1001
+ <TooltipPrimitive.Provider
1002
+ data-slot="tooltip-provider"
1003
+ delayDuration={delayDuration}
1004
+ {...props}
1005
+ />
1006
+ );
1007
+ }
1008
+
1009
+ function Tooltip({
1010
+ ...props
1011
+ }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
1012
+ return (
1013
+ <TooltipProvider>
1014
+ <TooltipPrimitive.Root data-slot="tooltip" {...props} />
1015
+ </TooltipProvider>
1016
+ );
1017
+ }
1018
+
1019
+ function TooltipTrigger({
1020
+ ...props
1021
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
1022
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
1023
+ }
1024
+
1025
+ function TooltipContent({
1026
+ className,
1027
+ sideOffset = 0,
1028
+ children,
1029
+ ...props
1030
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
1031
+ return (
1032
+ <TooltipPrimitive.Portal>
1033
+ <TooltipPrimitive.Content
1034
+ data-slot="tooltip-content"
1035
+ sideOffset={sideOffset}
1036
+ className={cn(
1037
+ "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 w-fit origin-[--radix-tooltip-content-transform-origin] text-balance rounded-md px-3 py-1.5 text-xs",
1038
+ className,
1039
+ )}
1040
+ {...props}
1041
+ >
1042
+ {children}
1043
+ <TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
1044
+ </TooltipPrimitive.Content>
1045
+ </TooltipPrimitive.Portal>
1046
+ );
1047
+ }
1048
+
1049
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
1050
+
1051
+ ```
1052
+
1053
+ ## eslint.config.ts
1054
+
1055
+ ```typescript
1056
+ export { default } from "@assistant-ui/x-buildutils/eslint";
1057
+
1058
+ ```
1059
+
1060
+ ## lib/utils.ts
1061
+
1062
+ ```typescript
1063
+ import { clsx, type ClassValue } from "clsx";
1064
+ import { twMerge } from "tailwind-merge";
1065
+
1066
+ export function cn(...inputs: ClassValue[]) {
1067
+ return twMerge(clsx(inputs));
1068
+ }
1069
+
1070
+ ```
1071
+
1072
+ ## next.config.ts
1073
+
1074
+ ```typescript
1075
+ import type { NextConfig } from "next";
1076
+
1077
+ const nextConfig: NextConfig = {
1078
+ /* config options here */
1079
+ };
1080
+
1081
+ export default nextConfig;
1082
+
1083
+ ```
1084
+
1085
+ ## package.json
1086
+
1087
+ ```json
1088
+ {
1089
+ "name": "with-cloud",
1090
+ "version": "0.1.0",
1091
+ "private": true,
1092
+ "scripts": {
1093
+ "dev": "next dev --turbo",
1094
+ "build": "next build",
1095
+ "start": "next start",
1096
+ "lint": "next lint"
1097
+ },
1098
+ "dependencies": {
1099
+ "@ai-sdk/openai": "^1.3.22",
1100
+ "@assistant-ui/react": "workspace:*",
1101
+ "@assistant-ui/react-ai-sdk": "workspace:*",
1102
+ "@assistant-ui/react-markdown": "workspace:*",
1103
+ "@radix-ui/react-slot": "^1.2.3",
1104
+ "@radix-ui/react-tooltip": "^1.2.7",
1105
+ "ai": "^4.3.16",
1106
+ "class-variance-authority": "^0.7.1",
1107
+ "clsx": "^2.1.1",
1108
+ "jsonwebtoken": "^9.0.2",
1109
+ "lucide-react": "^0.511.0",
1110
+ "nanoid": "5.1.5",
1111
+ "next": "15.3.3",
1112
+ "react": "19.1.0",
1113
+ "react-dom": "19.1.0",
1114
+ "remark-gfm": "^4.0.1",
1115
+ "tailwind-merge": "^3.3.0",
1116
+ "tw-animate-css": "^1.3.3"
1117
+ },
1118
+ "devDependencies": {
1119
+ "@assistant-ui/x-buildutils": "workspace:*",
1120
+ "@types/jsonwebtoken": "^9.0.9",
1121
+ "@types/node": "^22",
1122
+ "@types/react": "^19",
1123
+ "@types/react-dom": "^19",
1124
+ "eslint": "^9",
1125
+ "eslint-config-next": "15.3.3",
1126
+ "postcss": "^8",
1127
+ "tailwindcss": "^4.1.8",
1128
+ "typescript": "^5"
1129
+ }
1130
+ }
1131
+
1132
+ ```
1133
+
1134
+ ## tsconfig.json
1135
+
1136
+ ```json
1137
+ {
1138
+ "extends": "@assistant-ui/x-buildutils/ts/base",
1139
+ "compilerOptions": {
1140
+ "target": "ES6",
1141
+ "module": "ESNext",
1142
+ "incremental": true,
1143
+ "plugins": [
1144
+ {
1145
+ "name": "next"
1146
+ }
1147
+ ],
1148
+ "allowJs": true,
1149
+ "strictNullChecks": true,
1150
+ "jsx": "preserve",
1151
+ "paths": {
1152
+ "@/*": ["./*"],
1153
+ "@assistant-ui/*": ["../../packages/*/src"],
1154
+ "@assistant-ui/react/*": ["../../packages/react/src/*"],
1155
+ "assistant-stream": ["../../packages/assistant-stream/src"],
1156
+ "assistant-stream/*": ["../../packages/assistant-stream/src/*"]
1157
+ }
1158
+ },
1159
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
1160
+ "exclude": ["node_modules"]
1161
+ }
1162
+
1163
+ ```
1164
+