feat(chat): render the live turn's thinking in the dashboard (#1907)
Reasoning frames accumulate into streamingTurn.reasoning and the live row shows them in a collapsible Thinking trace built from the components/ui trace pattern, with a spinning icon and shimmering title while no reasoning has arrived yet. A turn that produces no reasoning renders no trace, and reasoning never leaks into the reply text.
This commit is contained in:
5 files changed
+197
-4
No files matched your search
@@ -63,9 +63,21 @@ const bubbles = computed(() => messages.value.map(parts));
|
||||
// the scroller sees one row grow and settle, not one leave and another arrive.
|
||||
const rows = computed(() => {
|
||||
const turn = streamingTurn.value;
|
||||
if (!turn) return bubbles.value.map((bubble) => ({ ...bubble, live: false }));
|
||||
if (!turn) {
|
||||
return bubbles.value.map((bubble) => ({
|
||||
...bubble,
|
||||
live: false,
|
||||
reasoning: "",
|
||||
thinkingPending: false,
|
||||
}));
|
||||
}
|
||||
return [
|
||||
...bubbles.value.map((bubble) => ({ ...bubble, live: false })),
|
||||
...bubbles.value.map((bubble) => ({
|
||||
...bubble,
|
||||
live: false,
|
||||
reasoning: "",
|
||||
thinkingPending: false,
|
||||
})),
|
||||
{
|
||||
id: `m${bubbles.value.length}`,
|
||||
text: turn.text || "…",
|
||||
@@ -75,6 +87,11 @@ const rows = computed(() => {
|
||||
update: undefined,
|
||||
choose: undefined,
|
||||
live: true,
|
||||
reasoning: turn.reasoning ?? "",
|
||||
// Nothing said and nothing reasoned yet: the turn may still be thinking,
|
||||
// so the row shows the pending thinking trace. Once the answer's text
|
||||
// arrives without any reasoning, the trace is not rendered at all.
|
||||
thinkingPending: !turn.text && !(turn.reasoning ?? ""),
|
||||
},
|
||||
];
|
||||
});
|
||||
@@ -120,6 +137,8 @@ useLiveResource("chat", () => void reloadTranscript());
|
||||
:media="row.media"
|
||||
:assistant="row.assistant"
|
||||
:streaming="row.live"
|
||||
:reasoning="row.reasoning"
|
||||
:thinking-pending="row.thinkingPending"
|
||||
>
|
||||
<template v-if="row.live && streamingTurn">
|
||||
<Button
|
||||
|
||||
Reference in new issue
Block a user