Spaces:
Sleeping
Sleeping
File size: 1,103 Bytes
23d418f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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>
)
}
|