diff --git a/src/components/ai-elements/actions.tsx b/src/components/ai-elements/actions.tsx
deleted file mode 100644
index 3961d908..00000000
--- a/src/components/ai-elements/actions.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-'use client';
-
-import { Button } from '@/components/ui/button';
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from '@/components/ui/tooltip';
-import { cn } from '@/lib/utils';
-import type { ComponentProps } from 'react';
-
-export type ActionsProps = ComponentProps<'div'>;
-
-export const Actions = ({ className, children, ...props }: ActionsProps) => (
-
- {children}
-
-);
-
-export type ActionProps = ComponentProps & {
- tooltip?: string;
- label?: string;
-};
-
-export const Action = ({
- tooltip,
- children,
- label,
- className,
- variant = 'ghost',
- size = 'sm',
- ...props
-}: ActionProps) => {
- const button = (
-
- );
-
- if (tooltip) {
- return (
-
-
- {button}
-
- {tooltip}
-
-
-
- );
- }
-
- return button;
-};
diff --git a/src/components/ai-elements/branch.tsx b/src/components/ai-elements/branch.tsx
deleted file mode 100644
index 70eb6c30..00000000
--- a/src/components/ai-elements/branch.tsx
+++ /dev/null
@@ -1,212 +0,0 @@
-'use client';
-
-import { Button } from '@/components/ui/button';
-import { cn } from '@/lib/utils';
-import type { UIMessage } from 'ai';
-import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
-import type { ComponentProps, HTMLAttributes, ReactElement } from 'react';
-import { createContext, useContext, useEffect, useState } from 'react';
-
-type BranchContextType = {
- currentBranch: number;
- totalBranches: number;
- goToPrevious: () => void;
- goToNext: () => void;
- branches: ReactElement[];
- setBranches: (branches: ReactElement[]) => void;
-};
-
-const BranchContext = createContext(null);
-
-const useBranch = () => {
- const context = useContext(BranchContext);
-
- if (!context) {
- throw new Error('Branch components must be used within Branch');
- }
-
- return context;
-};
-
-export type BranchProps = HTMLAttributes & {
- defaultBranch?: number;
- onBranchChange?: (branchIndex: number) => void;
-};
-
-export const Branch = ({
- defaultBranch = 0,
- onBranchChange,
- className,
- ...props
-}: BranchProps) => {
- const [currentBranch, setCurrentBranch] = useState(defaultBranch);
- const [branches, setBranches] = useState([]);
-
- const handleBranchChange = (newBranch: number) => {
- setCurrentBranch(newBranch);
- onBranchChange?.(newBranch);
- };
-
- const goToPrevious = () => {
- const newBranch =
- currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
- handleBranchChange(newBranch);
- };
-
- const goToNext = () => {
- const newBranch =
- currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
- handleBranchChange(newBranch);
- };
-
- const contextValue: BranchContextType = {
- currentBranch,
- totalBranches: branches.length,
- goToPrevious,
- goToNext,
- branches,
- setBranches,
- };
-
- return (
-
- div]:pb-0', className)}
- {...props}
- />
-
- );
-};
-
-export type BranchMessagesProps = HTMLAttributes
;
-
-export const BranchMessages = ({ children, ...props }: BranchMessagesProps) => {
- const { currentBranch, setBranches, branches } = useBranch();
- const childrenArray = Array.isArray(children) ? children : [children];
-
- // Use useEffect to update branches when they change
- useEffect(() => {
- if (branches.length !== childrenArray.length) {
- setBranches(childrenArray);
- }
- }, [childrenArray, branches, setBranches]);
-
- return childrenArray.map((branch, index) => (
- div]:pb-0',
- index === currentBranch ? 'block' : 'hidden'
- )}
- key={branch.key}
- {...props}
- >
- {branch}
-
- ));
-};
-
-export type BranchSelectorProps = HTMLAttributes & {
- from: UIMessage['role'];
-};
-
-export const BranchSelector = ({
- className,
- from,
- ...props
-}: BranchSelectorProps) => {
- const { totalBranches } = useBranch();
-
- // Don't render if there's only one branch
- if (totalBranches <= 1) {
- return null;
- }
-
- return (
-
- );
-};
-
-export type BranchPreviousProps = ComponentProps;
-
-export const BranchPrevious = ({
- className,
- children,
- ...props
-}: BranchPreviousProps) => {
- const { goToPrevious, totalBranches } = useBranch();
-
- return (
-
- );
-};
-
-export type BranchNextProps = ComponentProps;
-
-export const BranchNext = ({
- className,
- children,
- ...props
-}: BranchNextProps) => {
- const { goToNext, totalBranches } = useBranch();
-
- return (
-
- );
-};
-
-export type BranchPageProps = HTMLAttributes;
-
-export const BranchPage = ({ className, ...props }: BranchPageProps) => {
- const { currentBranch, totalBranches } = useBranch();
-
- return (
-
- {currentBranch + 1} of {totalBranches}
-
- );
-};
diff --git a/src/components/ai-elements/code-block.tsx b/src/components/ai-elements/code-block.tsx
deleted file mode 100644
index dba2012c..00000000
--- a/src/components/ai-elements/code-block.tsx
+++ /dev/null
@@ -1,148 +0,0 @@
-'use client';
-
-import { Button } from '@/components/ui/button';
-import { cn } from '@/lib/utils';
-import { CheckIcon, CopyIcon } from 'lucide-react';
-import type { ComponentProps, HTMLAttributes, ReactNode } from 'react';
-import { createContext, useContext, useState } from 'react';
-import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
-import {
- oneDark,
- oneLight,
-} from 'react-syntax-highlighter/dist/esm/styles/prism';
-
-type CodeBlockContextType = {
- code: string;
-};
-
-const CodeBlockContext = createContext({
- code: '',
-});
-
-export type CodeBlockProps = HTMLAttributes & {
- code: string;
- language: string;
- showLineNumbers?: boolean;
- children?: ReactNode;
-};
-
-export const CodeBlock = ({
- code,
- language,
- showLineNumbers = false,
- className,
- children,
- ...props
-}: CodeBlockProps) => (
-
-
-
-
- {code}
-
-
- {code}
-
- {children && (
-
- {children}
-
- )}
-
-
-
-);
-
-export type CodeBlockCopyButtonProps = ComponentProps & {
- onCopy?: () => void;
- onError?: (error: Error) => void;
- timeout?: number;
-};
-
-export const CodeBlockCopyButton = ({
- onCopy,
- onError,
- timeout = 2000,
- children,
- className,
- ...props
-}: CodeBlockCopyButtonProps) => {
- const [isCopied, setIsCopied] = useState(false);
- const { code } = useContext(CodeBlockContext);
-
- const copyToClipboard = async () => {
- if (typeof window === 'undefined' || !navigator.clipboard.writeText) {
- onError?.(new Error('Clipboard API not available'));
- return;
- }
-
- try {
- await navigator.clipboard.writeText(code);
- setIsCopied(true);
- onCopy?.();
- setTimeout(() => setIsCopied(false), timeout);
- } catch (error) {
- onError?.(error as Error);
- }
- };
-
- const Icon = isCopied ? CheckIcon : CopyIcon;
-
- return (
-
- );
-};
diff --git a/src/components/ai-elements/conversation.tsx b/src/components/ai-elements/conversation.tsx
deleted file mode 100644
index 1fb6b551..00000000
--- a/src/components/ai-elements/conversation.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-'use client';
-
-import { Button } from '@/components/ui/button';
-import { cn } from '@/lib/utils';
-import { ArrowDownIcon } from 'lucide-react';
-import type { ComponentProps } from 'react';
-import { useCallback } from 'react';
-import { StickToBottom, useStickToBottomContext } from 'use-stick-to-bottom';
-
-export type ConversationProps = ComponentProps;
-
-export const Conversation = ({ className, ...props }: ConversationProps) => (
-
-);
-
-export type ConversationContentProps = ComponentProps<
- typeof StickToBottom.Content
->;
-
-export const ConversationContent = ({
- className,
- ...props
-}: ConversationContentProps) => (
-
-);
-
-export type ConversationScrollButtonProps = ComponentProps;
-
-export const ConversationScrollButton = ({
- className,
- ...props
-}: ConversationScrollButtonProps) => {
- const { isAtBottom, scrollToBottom } = useStickToBottomContext();
-
- const handleScrollToBottom = useCallback(() => {
- scrollToBottom();
- }, [scrollToBottom]);
-
- return (
- !isAtBottom && (
-
- )
- );
-};
diff --git a/src/components/ai-elements/image.tsx b/src/components/ai-elements/image.tsx
deleted file mode 100644
index 405e1ee2..00000000
--- a/src/components/ai-elements/image.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { cn } from '@/lib/utils';
-import type { Experimental_GeneratedImage } from 'ai';
-
-export type ImageProps = Experimental_GeneratedImage & {
- className?: string;
- alt?: string;
-};
-
-export const Image = ({
- base64,
- uint8Array,
- mediaType,
- ...props
-}: ImageProps) => (
-
-);
diff --git a/src/components/ai-elements/inline-citation.tsx b/src/components/ai-elements/inline-citation.tsx
deleted file mode 100644
index 10e951cb..00000000
--- a/src/components/ai-elements/inline-citation.tsx
+++ /dev/null
@@ -1,287 +0,0 @@
-'use client';
-
-import { Badge } from '@/components/ui/badge';
-import {
- Carousel,
- CarouselContent,
- CarouselItem,
- type CarouselApi,
-} from '@/components/ui/carousel';
-import {
- HoverCard,
- HoverCardContent,
- HoverCardTrigger,
-} from '@/components/ui/hover-card';
-import { cn } from '@/lib/utils';
-import { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react';
-import {
- type ComponentProps,
- createContext,
- useCallback,
- useContext,
- useEffect,
- useState,
-} from 'react';
-
-export type InlineCitationProps = ComponentProps<'span'>;
-
-export const InlineCitation = ({
- className,
- ...props
-}: InlineCitationProps) => (
-
-);
-
-export type InlineCitationTextProps = ComponentProps<'span'>;
-
-export const InlineCitationText = ({
- className,
- ...props
-}: InlineCitationTextProps) => (
-
-);
-
-export type InlineCitationCardProps = ComponentProps;
-
-export const InlineCitationCard = (props: InlineCitationCardProps) => (
-
-);
-
-export type InlineCitationCardTriggerProps = ComponentProps & {
- sources: string[];
-};
-
-export const InlineCitationCardTrigger = ({
- sources,
- className,
- ...props
-}: InlineCitationCardTriggerProps) => (
-
-
- {sources.length ? (
- <>
- {new URL(sources[0]).hostname}{' '}
- {sources.length > 1 && `+${sources.length - 1}`}
- >
- ) : (
- 'unknown'
- )}
-
-
-);
-
-export type InlineCitationCardBodyProps = ComponentProps<'div'>;
-
-export const InlineCitationCardBody = ({
- className,
- ...props
-}: InlineCitationCardBodyProps) => (
-
-);
-
-const CarouselApiContext = createContext(undefined);
-
-const useCarouselApi = () => {
- const context = useContext(CarouselApiContext);
- return context;
-};
-
-export type InlineCitationCarouselProps = ComponentProps;
-
-export const InlineCitationCarousel = ({
- className,
- children,
- ...props
-}: InlineCitationCarouselProps) => {
- const [api, setApi] = useState();
-
- return (
-
-
- {children}
-
-
- );
-};
-
-export type InlineCitationCarouselContentProps = ComponentProps<'div'>;
-
-export const InlineCitationCarouselContent = (
- props: InlineCitationCarouselContentProps
-) => ;
-
-export type InlineCitationCarouselItemProps = ComponentProps<'div'>;
-
-export const InlineCitationCarouselItem = ({
- className,
- ...props
-}: InlineCitationCarouselItemProps) => (
-
-);
-
-export type InlineCitationCarouselHeaderProps = ComponentProps<'div'>;
-
-export const InlineCitationCarouselHeader = ({
- className,
- ...props
-}: InlineCitationCarouselHeaderProps) => (
-
-);
-
-export type InlineCitationCarouselIndexProps = ComponentProps<'div'>;
-
-export const InlineCitationCarouselIndex = ({
- children,
- className,
- ...props
-}: InlineCitationCarouselIndexProps) => {
- const api = useCarouselApi();
- const [current, setCurrent] = useState(0);
- const [count, setCount] = useState(0);
-
- useEffect(() => {
- if (!api) {
- return;
- }
-
- setCount(api.scrollSnapList().length);
- setCurrent(api.selectedScrollSnap() + 1);
-
- api.on('select', () => {
- setCurrent(api.selectedScrollSnap() + 1);
- });
- }, [api]);
-
- return (
-
- {children ?? `${current}/${count}`}
-
- );
-};
-
-export type InlineCitationCarouselPrevProps = ComponentProps<'button'>;
-
-export const InlineCitationCarouselPrev = ({
- className,
- ...props
-}: InlineCitationCarouselPrevProps) => {
- const api = useCarouselApi();
-
- const handleClick = useCallback(() => {
- if (api) {
- api.scrollPrev();
- }
- }, [api]);
-
- return (
-
- );
-};
-
-export type InlineCitationCarouselNextProps = ComponentProps<'button'>;
-
-export const InlineCitationCarouselNext = ({
- className,
- ...props
-}: InlineCitationCarouselNextProps) => {
- const api = useCarouselApi();
-
- const handleClick = useCallback(() => {
- if (api) {
- api.scrollNext();
- }
- }, [api]);
-
- return (
-
- );
-};
-
-export type InlineCitationSourceProps = ComponentProps<'div'> & {
- title?: string;
- url?: string;
- description?: string;
-};
-
-export const InlineCitationSource = ({
- title,
- url,
- description,
- className,
- children,
- ...props
-}: InlineCitationSourceProps) => (
-
- {title && (
-
{title}
- )}
- {url && (
-
{url}
- )}
- {description && (
-
- {description}
-
- )}
- {children}
-
-);
-
-export type InlineCitationQuoteProps = ComponentProps<'blockquote'>;
-
-export const InlineCitationQuote = ({
- children,
- className,
- ...props
-}: InlineCitationQuoteProps) => (
-
- {children}
-
-);
diff --git a/src/components/ai-elements/loader.tsx b/src/components/ai-elements/loader.tsx
deleted file mode 100644
index be469aa2..00000000
--- a/src/components/ai-elements/loader.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-import { cn } from '@/lib/utils';
-import type { HTMLAttributes } from 'react';
-
-type LoaderIconProps = {
- size?: number;
-};
-
-const LoaderIcon = ({ size = 16 }: LoaderIconProps) => (
-
-);
-
-export type LoaderProps = HTMLAttributes & {
- size?: number;
-};
-
-export const Loader = ({ className, size = 16, ...props }: LoaderProps) => (
-
-
-
-);
diff --git a/src/components/ai-elements/message.tsx b/src/components/ai-elements/message.tsx
deleted file mode 100644
index 8eaf6f8c..00000000
--- a/src/components/ai-elements/message.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import {
- Avatar,
- AvatarFallback,
- AvatarImage,
-} from '@/components/ui/avatar';
-import { cn } from '@/lib/utils';
-import type { UIMessage } from 'ai';
-import type { ComponentProps, HTMLAttributes } from 'react';
-
-export type MessageProps = HTMLAttributes & {
- from: UIMessage['role'];
-};
-
-export const Message = ({ className, from, ...props }: MessageProps) => (
- div]:max-w-[80%]',
- className
- )}
- {...props}
- />
-);
-
-export type MessageContentProps = HTMLAttributes
;
-
-export const MessageContent = ({
- children,
- className,
- ...props
-}: MessageContentProps) => (
-
-);
-
-export type MessageAvatarProps = ComponentProps & {
- src: string;
- name?: string;
-};
-
-export const MessageAvatar = ({
- src,
- name,
- className,
- ...props
-}: MessageAvatarProps) => (
-
-
- {name?.slice(0, 2) || 'ME'}
-
-);
diff --git a/src/components/ai-elements/prompt-input.tsx b/src/components/ai-elements/prompt-input.tsx
deleted file mode 100644
index d94cb1ca..00000000
--- a/src/components/ai-elements/prompt-input.tsx
+++ /dev/null
@@ -1,225 +0,0 @@
-'use client';
-
-import { Button } from '@/components/ui/button';
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from '@/components/ui/select';
-import { Textarea } from '@/components/ui/textarea';
-import { cn } from '@/lib/utils';
-import type { ChatStatus } from 'ai';
-import { Loader2Icon, SendIcon, SquareIcon, XIcon } from 'lucide-react';
-import type {
- ComponentProps,
- HTMLAttributes,
- KeyboardEventHandler,
-} from 'react';
-import { Children } from 'react';
-
-export type PromptInputProps = HTMLAttributes;
-
-export const PromptInput = ({ className, ...props }: PromptInputProps) => (
-
-);
-
-export type PromptInputTextareaProps = ComponentProps;
-
-export const PromptInputTextarea = ({
- onChange,
- className,
- placeholder = 'What would you like to know?',
- ...props
-}: PromptInputTextareaProps) => {
- const handleKeyDown: KeyboardEventHandler = (e) => {
- if (e.key === 'Enter') {
- // Don't submit if IME composition is in progress
- if (e.nativeEvent.isComposing) {
- return;
- }
-
- if (e.shiftKey) {
- // Allow newline
- return;
- }
-
- // Submit on Enter (without Shift)
- e.preventDefault();
- const form = e.currentTarget.form;
- if (form) {
- form.requestSubmit();
- }
- }
- };
-
- return (
-