@@ -12,17 +12,6 @@ import type {
1212 TextContentBlock ,
1313} from '../types/chat'
1414
15- const SHORT_THINKING_LINE_THRESHOLD = 5
16- const SHORT_THINKING_CHAR_LIMIT = 500
17-
18- /**
19- * Returns true if the thinking content is short enough to stay uncollapsed.
20- */
21- export const isShortThinkingContent = ( content : string ) : boolean => {
22- const trimmed = content . trim ( )
23- return trimmed . split ( '\n' ) . length <= SHORT_THINKING_LINE_THRESHOLD && trimmed . length <= SHORT_THINKING_CHAR_LIMIT
24- }
25-
2615let thinkingIdCounter = 0
2716const generateThinkingId = ( ) : string => {
2817 thinkingIdCounter ++
@@ -245,12 +234,10 @@ const appendTextWithThinkParsingToBlocks = (
245234 const thinkingOpen =
246235 ! hasMoreSegments && ! textToParse . includes ( THINK_CLOSE_TAG )
247236
248- const closedContent = currentLastBlock . content + firstSegment . content
249237 nextBlocks [ nextBlocks . length - 1 ] = {
250238 ...currentLastBlock ,
251- content : closedContent ,
239+ content : currentLastBlock . content + firstSegment . content ,
252240 thinkingOpen,
253- ...( ! thinkingOpen && isShortThinkingContent ( closedContent ) && { isCollapsed : false } ) ,
254241 }
255242 }
256243 segmentStartIdx = 1
@@ -262,7 +249,6 @@ const appendTextWithThinkParsingToBlocks = (
262249 nextBlocks [ nextBlocks . length - 1 ] = {
263250 ...currentLastBlock ,
264251 thinkingOpen : false ,
265- ...( isShortThinkingContent ( currentLastBlock . content ) && { isCollapsed : false } ) ,
266252 }
267253 }
268254 }
@@ -399,7 +385,6 @@ export const closeNativeReasoningBlock = (
399385 nextBlocks [ lastReasoningIndex ] = {
400386 ...reasoningBlock ,
401387 thinkingOpen : false ,
402- ...( isShortThinkingContent ( reasoningBlock . content ) && { isCollapsed : false } ) ,
403388 }
404389 return nextBlocks
405390}
0 commit comments