"use client"; import { useState, type CSSProperties } from "react"; import "./cited-answer.css"; /** * Cited Answer * Citations work both ways. Point at a [2] in the answer and source 2 lifts * out of the row above; point at a source and every sentence it supports is * underlined in the answer. Evidence and claim are never more than a glance * apart. */ export type Source = { domain: string; title: string }; export type Sentence = { text: string; cites: number[] }; type Props = { question: string; sources: Source[]; answer: Sentence[]; theme?: "paper" | "night"; className?: string }; export function CitedAnswer({ question, sources, answer, theme = "paper", className = "" }: Props) { const [hot, setHot] = useState(null); return (

{question}

Sources {sources.length}

    {sources.map((s, i) => (
  1. e.preventDefault()} onMouseEnter={() => setHot(i)} onMouseLeave={() => setHot(null)} onFocus={() => setHot(i)} onBlur={() => setHot(null)} > {s.title} {s.domain} {i + 1}
  2. ))}

Answer

{answer.map((s, k) => ( {s.text} {s.cites.map((c) => ( ))}{" "} ))}

); }