Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

refactor(web): replace AI Elements message components with shadcn chat components

Mohamed Bassem4423da19adae
diff --git a/apps/web/components/ai-elements/conversation.tsx b/apps/web/components/ai-elements/conversation.tsx
deleted file mode 100644
index 0d229bbf..00000000
--- a/apps/web/components/ai-elements/conversation.tsx
+++ /dev/null
@@ -1,168 +0,0 @@
-"use client";
-
-import { Button } from "@/components/ui/button";
-import { cn } from "@/lib/utils";
-import type { UIMessage } from "ai";
-import { ArrowDownIcon, DownloadIcon } from "lucide-react";
-import type { ComponentProps } from "react";
-import { useCallback } from "react";
-import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
-
-export type ConversationProps = ComponentProps<typeof StickToBottom>;
-
-export const Conversation = ({ className, ...props }: ConversationProps) => (
- <StickToBottom
- className={cn("relative flex-1 overflow-y-hidden", className)}
- initial="smooth"
- resize="smooth"
- role="log"
- {...props}
- />
-);
-
-export type ConversationContentProps = ComponentProps<
- typeof StickToBottom.Content
->;
-
-export const ConversationContent = ({
- className,
- ...props
-}: ConversationContentProps) => (
- <StickToBottom.Content
- className={cn("flex flex-col gap-8 p-4", className)}
- {...props}
- />
-);
-
-export type ConversationEmptyStateProps = ComponentProps<"div"> & {
- title?: string;
- description?: string;
- icon?: React.ReactNode;
-};
-
-export const ConversationEmptyState = ({
- className,
- title = "No messages yet",
- description = "Start a conversation to see messages here",
- icon,
- children,
- ...props
-}: ConversationEmptyStateProps) => (
- <div
- className={cn(
- "flex size-full flex-col items-center justify-center gap-3 p-8 text-center",
- className,
- )}
- {...props}
- >
- {children ?? (
- <>
- {icon && <div className="text-muted-foreground">{icon}</div>}
- <div className="space-y-1">
- <h3 className="text-sm font-medium">{title}</h3>
- {description && (
- <p className="text-sm text-muted-foreground">{description}</p>
- )}
- </div>
- </>
- )}
- </div>
-);
-
-export type ConversationScrollButtonProps = ComponentProps<typeof Button>;
-
-export const ConversationScrollButton = ({
- className,
- ...props
-}: ConversationScrollButtonProps) => {
- const { isAtBottom, scrollToBottom } = useStickToBottomContext();
-
- const handleScrollToBottom = useCallback(() => {
- scrollToBottom();
- }, [scrollToBottom]);
-
- return (
- !isAtBottom && (
- <Button
- className={cn(
- "absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted",
- className,
- )}
- onClick={handleScrollToBottom}
- size="icon"
- type="button"
- variant="outline"
- {...props}
- >
- <ArrowDownIcon className="size-4" />
- </Button>
- )
- );
-};
-
-const getMessageText = (message: UIMessage): string =>
- message.parts
- .filter((part) => part.type === "text")
- .map((part) => part.text)
- .join("");
-
-export type ConversationDownloadProps = Omit<
- ComponentProps<typeof Button>,
- "onClick"
-> & {
- messages: UIMessage[];
- filename?: string;
- formatMessage?: (message: UIMessage, index: number) => string;
-};
-
-const defaultFormatMessage = (message: UIMessage): string => {
- const roleLabel =
- message.role.charAt(0).toUpperCase() + message.role.slice(1);
- return `**${roleLabel}:** ${getMessageText(message)}`;
-};
-
-export const messagesToMarkdown = (
- messages: UIMessage[],
- formatMessage: (
- message: UIMessage,
- index: number,
- ) => string = defaultFormatMessage,
-): string => messages.map((msg, i) => formatMessage(msg, i)).join("\n\n");
-
-export const ConversationDownload = ({
- messages,
- filename = "conversation.md",
- formatMessage = defaultFormatMessage,
- className,
- children,
- ...props
-}: ConversationDownloadProps) => {
- const handleDownload = useCallback(() => {
- const markdown = messagesToMarkdown(messages, formatMessage);
- const blob = new Blob([markdown], { type: "text/markdown" });
- const url = URL.createObjectURL(blob);
- const link = document.createElement("a");
- link.href = url;
- link.download = filename;
- document.body.append(link);
- link.click();
- link.remove();
- URL.revokeObjectURL(url);
- }, [messages, filename, formatMessage]);
-
- return (
- <Button
- className={cn(
- "absolute right-4 top-4 rounded-full dark:bg-background dark:hover:bg-muted",
- className,
- )}
- onClick={handleDownload}
- size="icon"
- type="button"
- variant="outline"
- {...props}
- >
- {children ?? <DownloadIcon className="size-4" />}
- </Button>
- );
-};
diff --git a/apps/web/components/ai-elements/message.tsx b/apps/web/components/ai-elements/message.tsx
deleted file mode 100644
index ae286f28..00000000
--- a/apps/web/components/ai-elements/message.tsx
+++ /dev/null
@@ -1,354 +0,0 @@
-"use client";
-
-import { Button } from "@/components/ui/button";
-import { ButtonGroup, ButtonGroupText } from "@/components/ui/button-group";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip";
-import { cn } from "@/lib/utils";
-import { cjk } from "@streamdown/cjk";
-import { code } from "@streamdown/code";
-import { math } from "@streamdown/math";
-import { mermaid } from "@streamdown/mermaid";
-import type { UIMessage } from "ai";
-import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
-import type { ComponentProps, HTMLAttributes, ReactElement } from "react";
-import {
- createContext,
- memo,
- useCallback,
- useContext,
- useEffect,
- useMemo,
- useState,
-} from "react";
-import { Streamdown } from "streamdown";
-
-export type MessageProps = HTMLAttributes<HTMLDivElement> & {
- from: UIMessage["role"];
-};
-
-export const Message = ({ className, from, ...props }: MessageProps) => (
- <div
- className={cn(
- "group flex w-full max-w-[95%] flex-col gap-2",
- from === "user" ? "is-user ml-auto justify-end" : "is-assistant",
- className,
- )}
- {...props}
- />
-);
-
-export type MessageContentProps = HTMLAttributes<HTMLDivElement>;
-
-export const MessageContent = ({
- children,
- className,
- ...props
-}: MessageContentProps) => (
- <div
- className={cn(
- "is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm",
- "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground",
- "group-[.is-assistant]:text-foreground",
- className,
- )}
- {...props}
- >
- {children}
- </div>
-);
-
-export type MessageActionsProps = ComponentProps<"div">;
-
-export const MessageActions = ({
- className,
- children,
- ...props
-}: MessageActionsProps) => (
- <div className={cn("flex items-center gap-1", className)} {...props}>
- {children}
- </div>
-);
-
-export type MessageActionProps = ComponentProps<typeof Button> & {
- tooltip?: string;
- label?: string;
-};
-
-export const MessageAction = ({
- tooltip,
- children,
- label,
- variant = "ghost",
- size = "icon-sm",
- ...props
-}: MessageActionProps) => {
- const button = (
- <Button size={size} type="button" variant={variant} {...props}>
- {children}
- <span className="sr-only">{label || tooltip}</span>
- </Button>
- );
-
- if (tooltip) {
- return (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>{button}</TooltipTrigger>
- <TooltipContent>
- <p>{tooltip}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- );
- }
-
- return button;
-};
-
-interface MessageBranchContextType {
- currentBranch: number;
- totalBranches: number;
- goToPrevious: () => void;
- goToNext: () => void;
- branches: ReactElement[];
- setBranches: (branches: ReactElement[]) => void;
-}
-
-const MessageBranchContext = createContext<MessageBranchContextType | null>(
- null,
-);
-
-const useMessageBranch = () => {
- const context = useContext(MessageBranchContext);
-
- if (!context) {
- throw new Error(
- "MessageBranch components must be used within MessageBranch",
- );
- }
-
- return context;
-};
-
-export type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {
- defaultBranch?: number;
- onBranchChange?: (branchIndex: number) => void;
-};
-
-export const MessageBranch = ({
- defaultBranch = 0,
- onBranchChange,
- className,
- ...props
-}: MessageBranchProps) => {
- const [currentBranch, setCurrentBranch] = useState(defaultBranch);
- const [branches, setBranches] = useState<ReactElement[]>([]);
-
- const handleBranchChange = useCallback(
- (newBranch: number) => {
- setCurrentBranch(newBranch);
- onBranchChange?.(newBranch);
- },
- [onBranchChange],
- );
-
- const goToPrevious = useCallback(() => {
- const newBranch =
- currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
- handleBranchChange(newBranch);
- }, [currentBranch, branches.length, handleBranchChange]);
-
- const goToNext = useCallback(() => {
- const newBranch =
- currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
- handleBranchChange(newBranch);
- }, [currentBranch, branches.length, handleBranchChange]);
-
- const contextValue = useMemo<MessageBranchContextType>(
- () => ({
- branches,
- currentBranch,
- goToNext,
- goToPrevious,
- setBranches,
- totalBranches: branches.length,
- }),
- [branches, currentBranch, goToNext, goToPrevious],
- );
-
- return (
- <MessageBranchContext.Provider value={contextValue}>
- <div
- className={cn("grid w-full gap-2 [&>div]:pb-0", className)}
- {...props}
- />
- </MessageBranchContext.Provider>
- );
-};
-
-export type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;
-
-export const MessageBranchContent = ({
- children,
- ...props
-}: MessageBranchContentProps) => {
- const { currentBranch, setBranches, branches } = useMessageBranch();
- const childrenArray = useMemo(
- () => (Array.isArray(children) ? children : [children]),
- [children],
- );
-
- // Use useEffect to update branches when they change
- useEffect(() => {
- if (branches !== childrenArray) {
- setBranches(childrenArray);
- }
- }, [childrenArray, branches, setBranches]);
-
- return childrenArray.map((branch, index) => (
- <div
- className={cn(
- "grid gap-2 overflow-hidden [&>div]:pb-0",
- index === currentBranch ? "block" : "hidden",
- )}
- key={branch.key}
- {...props}
- >
- {branch}
- </div>
- ));
-};
-
-export type MessageBranchSelectorProps = ComponentProps<typeof ButtonGroup>;
-
-export const MessageBranchSelector = ({
- className,
- ...props
-}: MessageBranchSelectorProps) => {
- const { totalBranches } = useMessageBranch();
-
- // Don't render if there's only one branch
- if (totalBranches <= 1) {
- return null;
- }
-
- return (
- <ButtonGroup
- className={cn(
- "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
- className,
- )}
- orientation="horizontal"
- {...props}
- />
- );
-};
-
-export type MessageBranchPreviousProps = ComponentProps<typeof Button>;
-
-export const MessageBranchPrevious = ({
- children,
- ...props
-}: MessageBranchPreviousProps) => {
- const { goToPrevious, totalBranches } = useMessageBranch();
-
- return (
- <Button
- aria-label="Previous branch"
- disabled={totalBranches <= 1}
- onClick={goToPrevious}
- size="icon-sm"
- type="button"
- variant="ghost"
- {...props}
- >
- {children ?? <ChevronLeftIcon size={14} />}
- </Button>
- );
-};
-
-export type MessageBranchNextProps = ComponentProps<typeof Button>;
-
-export const MessageBranchNext = ({
- children,
- ...props
-}: MessageBranchNextProps) => {
- const { goToNext, totalBranches } = useMessageBranch();
-
- return (
- <Button
- aria-label="Next branch"
- disabled={totalBranches <= 1}
- onClick={goToNext}
- size="icon-sm"
- type="button"
- variant="ghost"
- {...props}
- >
- {children ?? <ChevronRightIcon size={14} />}
- </Button>
- );
-};
-
-export type MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;
-
-export const MessageBranchPage = ({
- className,
- ...props
-}: MessageBranchPageProps) => {
- const { currentBranch, totalBranches } = useMessageBranch();
-
- return (
- <ButtonGroupText
- className={cn(
- "border-none bg-transparent text-muted-foreground shadow-none",
- className,
- )}
- {...props}
- >
- {currentBranch + 1} of {totalBranches}
- </ButtonGroupText>
- );
-};
-
-export type MessageResponseProps = ComponentProps<typeof Streamdown>;
-
-const streamdownPlugins = { cjk, code, math, mermaid };
-
-export const MessageResponse = memo(
- ({ className, ...props }: MessageResponseProps) => (
- <Streamdown
- className={cn(
- "size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
- className,
- )}
- plugins={streamdownPlugins}
- {...props}
- />
- ),
-);
-
-MessageResponse.displayName = "MessageResponse";
-
-export type MessageToolbarProps = ComponentProps<"div">;
-
-export const MessageToolbar = ({
- className,
- children,
- ...props
-}: MessageToolbarProps) => (
- <div
- className={cn(
- "mt-4 flex w-full items-center justify-between gap-4",
- className,
- )}
- {...props}
- >
- {children}
- </div>
-);
diff --git a/apps/web/components/ui/bubble.tsx b/apps/web/components/ui/bubble.tsx
new file mode 100644
index 00000000..c36dff24
--- /dev/null
+++ b/apps/web/components/ui/bubble.tsx
@@ -0,0 +1,67 @@
+import * as React from "react";
+import { Slot } from "@radix-ui/react-slot";
+import { cva } from "class-variance-authority";
+import type { VariantProps } from "class-variance-authority";
+
+import { cn } from "@/lib/utils";
+
+const bubbleVariants = cva(
+ "relative flex w-fit min-w-0 max-w-[80%] flex-col gap-1 data-[variant=ghost]:max-w-full group-data-[align=end]/message:self-end",
+ {
+ variants: {
+ variant: {
+ default:
+ "[&>[data-slot=bubble-content]]:bg-primary [&>[data-slot=bubble-content]]:text-primary-foreground",
+ secondary:
+ "[&>[data-slot=bubble-content]]:bg-secondary [&>[data-slot=bubble-content]]:text-secondary-foreground",
+ muted: "[&>[data-slot=bubble-content]]:bg-muted",
+ tinted: "[&>[data-slot=bubble-content]]:bg-primary/10",
+ outline:
+ "[&>[data-slot=bubble-content]]:border-border [&>[data-slot=bubble-content]]:bg-background",
+ ghost:
+ "border-none [&>[data-slot=bubble-content]]:max-w-full [&>[data-slot=bubble-content]]:rounded-none [&>[data-slot=bubble-content]]:bg-transparent [&>[data-slot=bubble-content]]:p-0",
+ destructive:
+ "[&>[data-slot=bubble-content]]:bg-destructive/10 [&>[data-slot=bubble-content]]:text-destructive",
+ },
+ },
+ defaultVariants: { variant: "default" },
+ },
+);
+
+function Bubble({
+ variant = "default",
+ align = "start",
+ className,
+ ...props
+}: React.ComponentProps<"div"> &
+ VariantProps<typeof bubbleVariants> & { align?: "start" | "end" }) {
+ return (
+ <div
+ data-slot="bubble"
+ data-variant={variant}
+ data-align={align}
+ className={cn(bubbleVariants({ variant }), className)}
+ {...props}
+ />
+ );
+}
+
+function BubbleContent({
+ asChild = false,
+ className,
+ ...props
+}: React.ComponentProps<"div"> & { asChild?: boolean }) {
+ const Comp = asChild ? Slot : "div";
+ return (
+ <Comp
+ data-slot="bubble-content"
+ className={cn(
+ "w-fit min-w-0 max-w-full overflow-hidden break-words rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export { Bubble, BubbleContent, bubbleVariants };
diff --git a/apps/web/components/ui/marker.tsx b/apps/web/components/ui/marker.tsx
new file mode 100644
index 00000000..d9e984d4
--- /dev/null
+++ b/apps/web/components/ui/marker.tsx
@@ -0,0 +1,64 @@
+import * as React from "react";
+import { Slot } from "@radix-ui/react-slot";
+import { cva } from "class-variance-authority";
+import type { VariantProps } from "class-variance-authority";
+
+import { cn } from "@/lib/utils";
+
+const markerVariants = cva(
+ "group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4",
+ {
+ variants: {
+ variant: {
+ default: "",
+ separator:
+ "before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border",
+ border: "border-b border-border pb-2",
+ },
+ },
+ },
+);
+
+function Marker({
+ className,
+ variant = "default",
+ asChild = false,
+ ...props
+}: React.ComponentProps<"div"> &
+ VariantProps<typeof markerVariants> & { asChild?: boolean }) {
+ const Comp = asChild ? Slot : "div";
+ return (
+ <Comp
+ data-slot="marker"
+ data-variant={variant}
+ className={cn(markerVariants({ variant, className }))}
+ {...props}
+ />
+ );
+}
+
+function MarkerIcon({ className, ...props }: React.ComponentProps<"span">) {
+ return (
+ <span
+ data-slot="marker-icon"
+ aria-hidden="true"
+ className={cn("size-4 shrink-0", className)}
+ {...props}
+ />
+ );
+}
+
+function MarkerContent({ className, ...props }: React.ComponentProps<"span">) {
+ return (
+ <span
+ data-slot="marker-content"
+ className={cn(
+ "min-w-0 break-words group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export { Marker, MarkerIcon, MarkerContent, markerVariants };
diff --git a/apps/web/components/ui/message-scroller.tsx b/apps/web/components/ui/message-scroller.tsx
new file mode 100644
index 00000000..eb30e1f2
--- /dev/null
+++ b/apps/web/components/ui/message-scroller.tsx
@@ -0,0 +1,125 @@
+"use client";
+
+import * as React from "react";
+import {
+ MessageScroller as MessageScrollerPrimitive,
+ useMessageScroller,
+ useMessageScrollerScrollable,
+ useMessageScrollerVisibility,
+} from "@shadcn/react/message-scroller";
+import { ArrowDownIcon } from "lucide-react";
+
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+
+const MessageScrollerProvider = (
+ props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>,
+) => <MessageScrollerPrimitive.Provider {...props} />;
+
+function MessageScroller({
+ className,
+ ...props
+}: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
+ return (
+ <MessageScrollerPrimitive.Root
+ data-slot="message-scroller"
+ className={cn(
+ "group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function MessageScrollerViewport({
+ className,
+ ...props
+}: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
+ return (
+ <MessageScrollerPrimitive.Viewport
+ data-slot="message-scroller-viewport"
+ className={cn(
+ "size-full min-h-0 min-w-0 overflow-y-auto overscroll-contain",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function MessageScrollerContent({
+ className,
+ ...props
+}: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
+ return (
+ <MessageScrollerPrimitive.Content
+ data-slot="message-scroller-content"
+ className={cn("flex h-max min-h-full flex-col gap-8", className)}
+ {...props}
+ />
+ );
+}
+
+function MessageScrollerItem({
+ className,
+ scrollAnchor = false,
+ ...props
+}: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
+ return (
+ <MessageScrollerPrimitive.Item
+ data-slot="message-scroller-item"
+ scrollAnchor={scrollAnchor}
+ className={cn(
+ "min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function MessageScrollerButton({
+ direction = "end",
+ className,
+ children,
+ render,
+ variant = "secondary",
+ size = "icon-sm",
+ ...props
+}: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
+ return (
+ <MessageScrollerPrimitive.Button
+ data-direction={direction}
+ direction={direction}
+ className={cn(
+ "absolute left-1/2 -translate-x-1/2 border-border bg-background transition-all data-[active=false]:pointer-events-none data-[direction=end]:bottom-4 data-[direction=start]:top-4 data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[direction=start]:[&_svg]:rotate-180",
+ className,
+ )}
+ render={render ?? <Button variant={variant} size={size} />}
+ {...props}
+ >
+ {children ?? (
+ <>
+ <ArrowDownIcon />
+ <span className="sr-only">
+ {direction === "end" ? "Scroll to end" : "Scroll to start"}
+ </span>
+ </>
+ )}
+ </MessageScrollerPrimitive.Button>
+ );
+}
+
+export {
+ MessageScrollerProvider,
+ MessageScroller,
+ MessageScrollerViewport,
+ MessageScrollerContent,
+ MessageScrollerItem,
+ MessageScrollerButton,
+ useMessageScroller,
+ useMessageScrollerScrollable,
+ useMessageScrollerVisibility,
+};
diff --git a/apps/web/components/ui/message.tsx b/apps/web/components/ui/message.tsx
new file mode 100644
index 00000000..0997942f
--- /dev/null
+++ b/apps/web/components/ui/message.tsx
@@ -0,0 +1,88 @@
+import * as React from "react";
+
+import { cn } from "@/lib/utils";
+
+function MessageGroup({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div className={cn("flex min-w-0 flex-col gap-2", className)} {...props} />
+ );
+}
+
+function Message({
+ className,
+ align = "start",
+ ...props
+}: React.ComponentProps<"div"> & { align?: "start" | "end" }) {
+ return (
+ <div
+ data-slot="message"
+ data-align={align}
+ className={cn(
+ "group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function MessageAvatar({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="message-avatar"
+ className={cn(
+ "flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function MessageContent({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="message-content"
+ className={cn(
+ "flex w-full min-w-0 flex-col gap-2.5 break-words group-data-[align=end]/message:*:self-end",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function MessageHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="message-header"
+ className={cn(
+ "flex min-w-0 max-w-full items-center px-3 text-xs font-medium text-muted-foreground",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function MessageFooter({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="message-footer"
+ className={cn(
+ "flex min-w-0 max-w-full items-center px-3 text-xs font-medium text-muted-foreground group-data-[align=end]/message:justify-end",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export {
+ MessageGroup,
+ Message,
+ MessageAvatar,
+ MessageContent,
+ MessageFooter,
+ MessageHeader,
+};
diff --git a/apps/web/package.json b/apps/web/package.json
index 68c27257..e6abb49c 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -54,6 +54,7 @@
"@radix-ui/react-toggle": "^1.1.9",
"@radix-ui/react-tooltip": "^1.2.7",
"@radix-ui/react-visually-hidden": "^1.2.3",
+ "@shadcn/react": "^0.2.1",
"@streamdown/cjk": "^1.0.3",
"@streamdown/code": "^1.1.1",
"@streamdown/math": "^1.0.2",
@@ -109,7 +110,6 @@
"streamdown": "^2.5.0",
"superjson": "^2.2.1",
"tailwind-merge": "^2.2.1",
- "use-stick-to-bottom": "^1.1.4",
"zod": "^4.0.0",
"zustand": "^5.0.5"
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b6c3b52c..218f6862 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -642,6 +642,9 @@ importers:
'@radix-ui/react-visually-hidden':
specifier: ^1.2.3
+ '@shadcn/react':
+ specifier: ^0.2.1
+ version: 0.2.1(@types/[email protected])([email protected])
'@streamdown/cjk':
specifier: ^1.0.3
@@ -807,9 +810,6 @@ importers:
tailwind-merge:
specifier: ^2.2.1
version: 2.2.1
- use-stick-to-bottom:
- specifier: ^1.1.4
- version: 1.1.4([email protected])
zod:
specifier: ^4.0.0
version: 4.3.6
@@ -3528,11 +3528,11 @@ packages:
'@esbuild-kit/[email protected]':
resolution: {integrity: sha512-sPRAnw9CdSsRmEtnsl2WXWdyquogVpB3yZ3dgwJfe8zrOzTsV7cJvmwrKVa+0ma5BoiGJ+BoqkMvawbayKUsqQ==}
- deprecated: 'Merged into tsx: https://tsx.is'
+ deprecated: 'Merged into tsx: https://tsx.hirok.io'
'@esbuild-kit/[email protected]':
resolution: {integrity: sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA==}
- deprecated: 'Merged into tsx: https://tsx.is'
+ deprecated: 'Merged into tsx: https://tsx.hirok.io'
'@esbuild/[email protected]':
resolution: {integrity: sha512-ShbM/3XxwuxjFiuVBHA+d3j5dyac0aEVVq1oluIDf71hUw0aRF59dV/efUsIwFnR6m8JNM2FjZOzmaZ8yG61kw==}
@@ -6889,6 +6889,17 @@ packages:
resolution: {integrity: sha512-q8nke2GDSwEiu1zYoctDDvnSNTjHWoVAKo2JXTleD0nwOO6IlAgUYmsm3qEQiSW7BVla9W1TRbW6ChFAUXYZbw==}
engines: {node: '>=18'}
+ '@shadcn/[email protected]':
+ resolution: {integrity: sha512-5krgi3dRMKb5jH6a+qPzVJUy/54s0kKE4Rw4LjDfLqOdVQTWKUgxWf1kW8r912I0jX/Lzxqc+pgjkjWxUIK5BQ==}
+ peerDependencies:
+ '@types/react': '>=19'
+ react: '>=19'
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ react:
+ optional: true
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==}
@@ -16924,11 +16935,6 @@ packages:
'@types/react':
optional: true
- resolution: {integrity: sha512-2w/lydkrwhWMv1vCaEhYbzMDhgbwIodHpAHPV0/xKJErRkbjDEUe1EWmvr6Fwb+qhiERjc1EWgAEZaSaF69CpA==}
- peerDependencies:
- react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
-
resolution: {integrity: sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==}
peerDependencies:
@@ -24207,6 +24213,11 @@ snapshots:
'@sentry/browser-utils': 10.64.0
'@sentry/core': 10.64.0
+ optionalDependencies:
+ '@types/react': 19.2.15
+ react: 19.2.6
+
'@shikijs/[email protected]':
dependencies:
'@shikijs/types': 3.23.0
@@ -36408,10 +36419,6 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.15
- dependencies:
- react: 19.2.6
-
dependencies:
react: 19.2.6