Compare commits

...

1 Commits

Author SHA1 Message Date
rekram1-node 059d2d3362 fix(desktop): show completed opaque reasoning 2026-08-20 05:40:07 +00:00
4 changed files with 48 additions and 5 deletions
@@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test"
import {
assistantMessage,
partUpdated,
reasoningPart,
setupTimeline,
status,
@@ -91,3 +92,26 @@ test("does not infer reasoning visibility from provider identity", async ({ page
await expect(page.locator('[data-timeline-part-id*="reasoning"]')).toHaveCount(0)
await expect(page.locator('[data-timeline-part-id="prt_provider_text"]')).toBeVisible()
})
test("replaces Thinking with a plain Thought label when opaque reasoning completes", async ({ page }) => {
const reasoningID = "prt_reasoning_opaque"
const reasoning = {
...reasoningPart(reasoningID, ""),
metadata: { anthropic: { redactedData: "opaque" } },
}
const timeline = await setupTimeline(page, {
messages: [userMessage(), assistantMessage([reasoning], { completed: false })],
settings: { showReasoningSummaries: true },
})
await timeline.send(status("busy"), 150)
await expect(page.locator('[data-timeline-row="Thinking"]')).toBeVisible()
await expect(page.locator(`[data-timeline-part-id="${reasoningID}"]`)).toHaveCount(0)
await timeline.send(partUpdated({ ...reasoning, time: { start: 1700000001000, end: 1700000002000 } }), 150)
const completed = page.locator(`[data-timeline-part-id="${reasoningID}"]`)
await expect(page.locator('[data-timeline-row="Thinking"]')).toHaveCount(0)
await expect(completed).toHaveText("Thought")
await expect(completed.locator("button")).toHaveCount(0)
})
@@ -295,6 +295,12 @@
color: var(--v2-text-text-muted);
line-height: var(--line-height-normal);
[data-slot="reasoning-part-label"] {
display: block;
margin-top: 16px;
font-size: 13px;
}
[data-component="markdown"] {
margin-top: 16px;
font-style: normal;
@@ -715,10 +715,14 @@ export function renderable(part: PartType, showReasoningSummaries = true) {
return true
}
if (part.type === "text") return !!part.text?.trim()
if (part.type === "reasoning") return showReasoningSummaries && !!part.text?.trim()
if (part.type === "reasoning") return showReasoningSummaries && (!!part.text?.trim() || opaqueReasoning(part))
return !!PART_MAPPING[part.type]
}
function opaqueReasoning(part: ReasoningPart) {
return !part.text.trim() && Boolean(part.metadata) && part.time.end !== undefined
}
export { partDefaultOpen } from "./part-default-open"
export function AssistantParts(props: {
@@ -1758,6 +1762,7 @@ PART_MAPPING["text"] = function TextPartDisplay(props) {
PART_MAPPING["reasoning"] = function ReasoningPartDisplay(props) {
const data = useData()
const i18n = useI18n()
const part = () => props.part as ReasoningPart
const streaming = createMemo(
() => props.message.role === "assistant" && typeof (props.message as AssistantMessage).time.completed !== "number",
@@ -1765,11 +1770,18 @@ PART_MAPPING["reasoning"] = function ReasoningPartDisplay(props) {
const text = () => readPartText(data.store.part_text_accum_delta, part())
return (
<Show when={text()}>
<div data-component="reasoning-part" data-timeline-part-id={part().id}>
<div data-component="reasoning-part" data-timeline-part-id={part().id}>
<Show
when={text()}
fallback={
<Show when={opaqueReasoning(part())}>
<span data-slot="reasoning-part-label">{i18n.t("ui.messagePart.reasoning.opaque")}</span>
</Show>
}
>
<PacedMarkdown text={text()} cacheKey={part().id} streaming={streaming()} />
</div>
</Show>
</Show>
</div>
)
}
+1
View File
@@ -102,6 +102,7 @@ export const dict: Record<string, string> = {
"ui.messagePart.review.title": "Review your answers",
"ui.messagePart.questions.dismissed": "Questions dismissed",
"ui.messagePart.compaction": "Session compacted",
"ui.messagePart.reasoning.opaque": "Thought",
"ui.messagePart.context.read.one": "{{count}} read",
"ui.messagePart.context.read.other": "{{count}} reads",
"ui.messagePart.context.search.one": "{{count}} search",