ResponseView
A model's response as it arrives: nothing until the first token, Markdown as it streams, reasoning in a Thinking disclosure, and calm stopped, cut-off and failed states.
Subject: Your order #4471 is on its way — and we’re sorry it’s late
Hi Maya,
Your order #4471 left our warehouse on time, but a delay with our carrier held it up for three days. That’s not the experience we want for you, and I’m sorry.
It’s moving again and should arrive by Thursday. As a thank-you for your patience, your next order ships free — the code is applied to your account automatically.
Warmly,
The Northwind team
- First token
- 1.18 s
- Total
- 6.12 s
function Stream() {
const [state, setState] = useState<{ status: ResponseStatus; text: string; reasoning: string; took?: number; started?: number; total?: number }>({
status: "done",
text: gpt.text,
reasoning: gpt.reasoning!,
took: 3800,
total: 6120,
});
const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
useEffect(() => () => clearTimeout(timer.current), []);
const play = () => {
clearTimeout(timer.current);
const started = Date.now();
let r = 0;
let t = 0;
let took: number | undefined;
setState({ status: "pending", text: "", reasoning: "", started });
const tick = () => {
if (r < gpt.reasoning!.length) r += 8;
else {
took ??= Date.now() - started;
t += 6;
}
const done = t >= gpt.text.length;
setState({
status: done ? "done" : "streaming",
reasoning: gpt.reasoning!.slice(0, r),
text: gpt.text.slice(0, t),
started,
...(took !== undefined ? { took } : {}),
...(done ? { total: Date.now() - started } : {}),
});
if (!done) timer.current = setTimeout(tick, 24);
};
timer.current = setTimeout(tick, 700);
};
return (
<div className="flex w-full max-w-560 flex-col gap-16">
<div>
<Button size="sm" onClick={play} disabled={state.status === "pending" || state.status === "streaming"}>
Stream it again
</Button>
</div>
<ResponseView
aria-label="GPT-5 response"
status={state.status}
text={state.text}
reasoning={state.reasoning}
{...(state.took !== undefined ? { reasoningDuration: state.took } : {})}
footer={
<ResponseMetrics
live={state.status === "pending" || state.status === "streaming"}
startedAt={state.started}
duration={state.total}
timeToFirstToken={state.status === "pending" ? undefined : 1180}
/>
}
/>
</div>
);
}import { ResponseView, UserMessage, Thread } from "@logicplanes/kaeso-ui/playground";Props
aria-labelstringThe response's accessible name ("GPT-5 response" in a comparison). Defaults to "Response" in the provider's language.
defaultReasoningOpenbooleanWhether the reasoning starts expanded.
errorstringWhy the reply failed, shown under "No response" with status "error": the gateway's message in the reader's language;
codespans render as code.footerReactNodeUnder the response, after Copy and Retry on their row: its metrics.
incompleteReasonstringWhy the model cut the reply off, with status "incomplete":
max_output_tokensreads "Stopped at the output limit",content_filternames the filter.onReasoningOpenChange((open: boolean) => void)Called when the reasoning is expanded or collapsed.
onRetry(() => void)Sends the turn again: a Retry button after a stop, a cut-off reply or an error, and a quiet Retry circle under a finished reply.
reasoningstringThe reasoning summary so far, as Markdown. A "Thinking" disclosure shows it, closed by default.
reasoningDurationnumberHow long the model reasoned, in milliseconds: "Thought for 4.2 s".
reasoningOpenbooleanWhether the reasoning is expanded, when you control it.
status"done" | "error" | "streaming" | "pending" | "stopped" | "incomplete" = doneWhere the reply stands: waiting, streaming, done, stopped, cut off by the model (incomplete) or failed.
textstringThe output text so far, as Markdown.