import { CircleAlert } from 'lucide-react' import { seconds, usd } from '@/lib/format' import type { RunState } from '@/lib/run' import { Sources } from './Sources' import { Trace } from './Trace' /** An answer: how it was made (Trace), the text, what a broker would still need to find * out, a version note, the numbered sources, and what it took. `recorded`: a held-out * run shown on the Evals page (its cost line says what it cost then). */ export function AnswerBody({ run, lastEventAt, recorded = false }: { run: RunState; lastEventAt: number; recorded?: boolean }) { const a = run.answer return (
{run.error && (

{run.error}

)} {a && ( <> {a.abstain && (

Can't determine this from the documents

)}
{a.answer}
{a.missing_info.length > 0 && (

What a broker would need to find out

    {a.missing_info.map((m, i) => (
  • {m}
  • ))}
)} {a.flagged.length > 0 && (

Version note: {a.flagged.join(', ')} {a.flagged.length > 1 ? 'are' : 'is'} not in force on the policy date by {a.flagged.length > 1 ? 'their' : 'its'} stated dates, and no version of the form is: the answer may rest on an edition that is not the one on the policy.

)} {a.citations.length > 0 && }

Confidence {Math.round(a.confidence * 100)}% · {seconds(a.latency_ms)} ·{' '} {(a.usage.tokens_in + a.usage.tokens_out).toLocaleString()} tokens ·{' '} {recorded ? `${usd(a.usage.cost_usd)} when recorded` : a.usage.cached ? 'repeated question, answered from memory' : usd(a.usage.cost_usd)}

)}
) }