Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion packages/ui/src/components/session-turn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,17 @@ export function SessionTurn(

const isShellMode = createMemo(() => !!shellModePart())

const hasReasoningParts = createMemo(() => {
for (const m of assistantMessages()) {
const msgParts = data.store.part[m.id]
if (!msgParts) continue
for (const p of msgParts) {
if (p?.type === "reasoning") return true
}
}
return false
})

const rawStatus = createMemo(() => {
const msgs = assistantMessages()
let last: PartType | undefined
Expand Down Expand Up @@ -514,6 +525,8 @@ export function SessionTurn(
retrySeconds: 0,
status: rawStatus(),
duration: duration(),
userMessageHovered: false,
showReasoning: false,
})

createEffect(() => {
Expand Down Expand Up @@ -747,7 +760,7 @@ export function SessionTurn(
message={assistantMessage}
responsePartId={responsePartId()}
hideResponsePart={hideResponsePart()}
hideReasoning={!working()}
hideReasoning={!working() && !store.showReasoning}
hidden={hidden}
/>
)}
Expand Down Expand Up @@ -775,6 +788,22 @@ export function SessionTurn(
<div data-slot="session-turn-summary-header">
<div data-slot="session-turn-summary-title-row">
<h2 data-slot="session-turn-summary-title">{i18n.t("ui.sessionTurn.summary.response")}</h2>

<Show when={hasReasoningParts()}>
<Button
data-slot="session-turn-thinking-toggle"
variant="ghost"
size="small"
onMouseDown={(e: MouseEvent) => e.preventDefault()}
onClick={(event: MouseEvent) => {
event.stopPropagation()
setStore("showReasoning", (prev) => !prev)
}}
>
{store.showReasoning ? "Hide thinking" : "Show thinking"}
</Button>
</Show>

<Show when={response()}>
<div data-slot="session-turn-response-copy-wrapper">
<Tooltip
Expand All @@ -797,6 +826,7 @@ export function SessionTurn(
</div>
</Show>
</div>

<div data-slot="session-turn-response">
<Markdown
data-slot="session-turn-markdown"
Expand Down
Loading