"use client" import { useMemo } from "react" import type { UIMessage } from "@ai-sdk/react" import { MemoryGraph } from "@/components/memory-graph" import { AnimatedGradientBackground } from "@/components/animated-gradient-background" import { useProject } from "@/stores" import { extractHighlightDocumentIdsFromMessages } from "@/lib/chat-highlight-documents" import { cn } from "@lib/utils" import { dmSansClassName } from "@/lib/fonts" export function ChatGraphContextRail({ messages, containerTags, className, }: { messages: UIMessage[] containerTags?: string[] | null className?: string }) { const { effectiveContainerTags } = useProject() const graphContainerTags = containerTags === undefined ? effectiveContainerTags : (containerTags ?? undefined) const highlightIds = useMemo( () => extractHighlightDocumentIdsFromMessages(messages), [messages], ) return (
Memory map
{highlightIds.length > 0 ? `${highlightIds.length} memor${highlightIds.length === 1 ? "y" : "ies"} used by Nova` : "Memories used by Nova will be highlighted here"}