CoverageCheck / web /src /components /chat /Message.tsx
TBM99's picture
Deploy coverage-check 3559250
23d418f verified
Raw History Blame Contribute Delete
1.1 kB
import type { Turn } from '@/hooks/useChat'
import { AnswerBody } from './AnswerBody'
/** One turn of the conversation: the question (right, with how a follow-up was
* understood), then the answer (AnswerBody, shared with the Evals page's examples). */
export function Message({ turn }: { turn: Turn }) {
const { run } = turn
return (
<div className="space-y-4">
<div className="flex flex-col items-end gap-1">
<div className="max-w-[85%] rounded-2xl rounded-br-md bg-primary px-4 py-2.5 text-[15px] whitespace-pre-wrap text-primary-foreground">
{turn.question}
</div>
{run.rewrite?.changed && (
<p className="max-w-[85%] text-right text-xs text-muted-foreground">
Understood as: <span className="text-foreground/80 italic">{run.rewrite.question}</span>
</p>
)}
<span className="text-[11px] text-muted-foreground">
System {turn.system.toUpperCase()} · policy date {turn.day ?? 'today'}
</span>
</div>
<AnswerBody run={run} lastEventAt={turn.lastEventAt} />
</div>
)
}