"use client" import { ActionBarPrimitive, BranchPickerPrimitive, ComposerPrimitive, MessagePrimitive, ThreadPrimitive, ThreadListItemPrimitive, ThreadListPrimitive, useMessage, } from "@assistant-ui/react"; import type { FC } from "react"; import { ArrowDownIcon, CheckIcon, ChevronLeftIcon, ChevronRightIcon, CopyIcon, PencilIcon, RefreshCwIcon, SendHorizontalIcon, ArchiveIcon, PlusIcon, } from "lucide-react"; import { cn } from "@/lib/utils"; import { Dispatch, SetStateAction, useState } from "react"; import { Button } from "@/components/ui/button"; import { ScrollArea } from "../ui/scroll-area"; import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button"; import { MemoryUI } from "./memory-ui"; import MarkdownRenderer from "../mem0/markdown"; import React from "react"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; interface ThreadProps { sidebarOpen: boolean; setSidebarOpen: Dispatch>; onResetUserId?: () => void; } export const Thread: FC = ({ sidebarOpen, setSidebarOpen, onResetUserId }) => { const [resetDialogOpen, setResetDialogOpen] = useState(false); return ( {/* Mobile sidebar overlay */} {sidebarOpen && (
setSidebarOpen(false)} >
)} {/* Mobile sidebar drawer */}

Recent Chats

{onResetUserId && ( Reset Memory This will permanently delete all your chat history and memories. This action cannot be undone. Cancel { onResetUserId(); setResetDialogOpen(false); }} className="bg-[#4f46e5] hover:bg-[#4338ca] dark:bg-[#6366f1] dark:hover:bg-[#4f46e5] text-white" > Reset )}

Recent Chats

); }; const ThreadScrollToBottom: FC = () => { return ( ); }; const ThreadWelcome: FC = () => { return (
Mem0 Demo

A personalized AI chat app powered by Mem0 that remembers your preferences, facts, and memories.

How can I help you today?

); }; const ThreadWelcomeSuggestions: FC = () => { return (
Travel Food Project details
); }; const Composer: FC = () => { return ( ); }; const ComposerAction: FC = () => { return ( <> ); }; const UserMessage: FC = () => { return (
); }; const UserActionBar: FC = () => { return ( ); }; const EditComposer: FC = () => { return (
); }; const AssistantMessage: FC = () => { const content = useMessage((m) => m.content); const markdownText = React.useMemo(() => { if (!content) return ''; if (typeof content === 'string') return content; if (Array.isArray(content) && content.length > 0 && 'text' in content[0]) { return content[0].text || ''; } return ''; }, [content]); return (
); }; const AssistantActionBar: FC = () => { return ( ); }; const BranchPicker: FC = ({ className, ...rest }) => { return ( / ); }; const CircleStopIcon = () => { return ( ); }; // Component for reuse in mobile drawer const ThreadListItem: FC = () => { return (

); };