import type { CaseError, TurnState } from '../hooks/useRunSession' import ChatBubble from './ChatBubble' import { colors } from '../tokens' interface TurnListProps { turns: TurnState[] errors?: CaseError[] showRoundLabel?: boolean gap?: number } /** * Renders a list of conversation turns as chat bubbles. * Consolidates the previously duplicated turn-rendering logic from CaseBlock * and CaseDetail (and eventually Reports). */ export default function TurnList({ turns, errors = [], showRoundLabel = true, gap = 4 }: TurnListProps) { return ( <> {turns.map((t) => (
{showRoundLabel && (
第 {t.roundIndex} 轮 {t.latency_ms != null && ( {t.latency_ms}ms )}
)} {t.message && } {t.error ? ( ) : t.pending ? ( ) : t.reply ? ( ) : null}
))} {errors.filter((e) => e.round == null).map((e, i) => ( ))} ) }