Skip to content

Commit 5e0db80

Browse files
tlgimenesclaude
andauthored
refactor(chat): show line-based thinking summary instead of full text (#2774)
Keep thinking panel collapsed during streaming by removing forceOpen. Summary now shows last reasoning line while streaming (latest thought) and first line when done (topic), instead of the full concatenated text. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1cc3fa1 commit 5e0db80

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

apps/mesh/src/web/components/chat/message/assistant.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,23 @@ function ThoughtSummary({
118118
: "Thought"
119119
: "Thought";
120120

121+
// Join with newlines (not spaces) so we can extract individual lines
121122
const rawText = parts
122123
.map((p) => p.text ?? "")
123-
.join(" ")
124+
.join("\n")
124125
.trim();
126+
const lines = rawText.split("\n").filter(Boolean);
127+
128+
// Streaming: show last line (latest thinking). Done: show first line (topic).
129+
const summaryLine = isStreaming
130+
? (lines[lines.length - 1] ?? "")
131+
: (lines[0] ?? "");
132+
125133
const summary =
126-
!allPartsRedacted && rawText
127-
? rawText.length > 100
128-
? rawText.slice(0, 100) + "…"
129-
: rawText
134+
!allPartsRedacted && summaryLine
135+
? summaryLine.length > 100
136+
? summaryLine.slice(0, 100) + "…"
137+
: summaryLine
130138
: undefined;
131139

132140
const fullText = parts.map((p) => p.text ?? "").join("\n\n");
@@ -150,7 +158,6 @@ function ThoughtSummary({
150158
state={isStreaming ? "loading" : "idle"}
151159
detailVariant="prose"
152160
latency={latency}
153-
forceOpen={isStreaming}
154161
/>
155162
);
156163
}

0 commit comments

Comments
 (0)