"use client"; import type { FC } from "react"; import { useState } from "react"; import { useCitationMetadata } from "@/components/assistant-ui/citation-metadata-context"; import { SourceDetailPanel } from "@/components/new-chat/source-detail-panel"; import { Citation } from "@/components/tool-ui/citation"; interface InlineCitationProps { chunkId: number; isDocsChunk?: boolean; } /** * Inline citation for knowledge-base chunks (numeric chunk IDs). * Renders a clickable badge showing the actual chunk ID that opens the SourceDetailPanel. */ export const InlineCitation: FC = ({ chunkId, isDocsChunk = false }) => { const [isOpen, setIsOpen] = useState(false); return ( ); }; function extractDomain(url: string): string { try { const hostname = new URL(url).hostname; return hostname.replace(/^www\./, ""); } catch { return url; } } interface UrlCitationProps { url: string; } /** * Inline citation for live web search results (URL-based chunk IDs). * Renders a compact chip with favicon + domain and a hover popover showing the * page title and snippet (extracted deterministically from web_search tool results). */ export const UrlCitation: FC = ({ url }) => { const domain = extractDomain(url); const meta = useCitationMetadata(url); return ( ); };