@@ -16,7 +16,7 @@ import { vscode } from "../../utils/vscode"
1616import CodeAccordian , { removeLeadingNonAlphanumeric } from "../common/CodeAccordian"
1717import CodeBlock , { CODE_BLOCK_BG_COLOR } from "../common/CodeBlock"
1818import MarkdownBlock from "../common/MarkdownBlock"
19- import ReasoningBlock from "./ReasoningBlock"
19+ import { ReasoningBlock } from "./ReasoningBlock"
2020import Thumbnails from "../common/Thumbnails"
2121import McpResourceRow from "../mcp/McpResourceRow"
2222import McpToolRow from "../mcp/McpToolRow"
@@ -25,12 +25,12 @@ import { CheckpointSaved } from "./checkpoints/CheckpointSaved"
2525
2626interface ChatRowProps {
2727 message : ClineMessage
28- isExpanded : boolean
29- onToggleExpand : ( ) => void
3028 lastModifiedMessage ?: ClineMessage
29+ isExpanded : boolean
3130 isLast : boolean
32- onHeightChange : ( isTaller : boolean ) => void
3331 isStreaming : boolean
32+ onToggleExpand : ( ) => void
33+ onHeightChange : ( isTaller : boolean ) => void
3434}
3535
3636interface ChatRowContentProps extends Omit < ChatRowProps , "onHeightChange" > { }
@@ -43,10 +43,7 @@ const ChatRow = memo(
4343 const prevHeightRef = useRef ( 0 )
4444
4545 const [ chatrow , { height } ] = useSize (
46- < div
47- style = { {
48- padding : "10px 6px 10px 15px" ,
49- } } >
46+ < div className = "px-[15px] py-[10px] pr-[6px]" >
5047 < ChatRowContent { ...props } />
5148 </ div > ,
5249 )
@@ -75,33 +72,32 @@ export default ChatRow
7572
7673export const ChatRowContent = ( {
7774 message,
78- isExpanded,
79- onToggleExpand,
8075 lastModifiedMessage,
76+ isExpanded,
8177 isLast,
8278 isStreaming,
79+ onToggleExpand,
8380} : ChatRowContentProps ) => {
8481 const { mcpServers, alwaysAllowMcp, currentCheckpoint } = useExtensionState ( )
85- const [ reasoningCollapsed , setReasoningCollapsed ] = useState ( false )
82+ const [ reasoningCollapsed , setReasoningCollapsed ] = useState ( true )
8683
87- // Auto-collapse reasoning when new messages arrive
88- useEffect ( ( ) => {
89- if ( ! isLast && message . say === "reasoning" ) {
90- setReasoningCollapsed ( true )
91- }
92- } , [ isLast , message . say ] )
9384 const [ cost , apiReqCancelReason , apiReqStreamingFailedMessage ] = useMemo ( ( ) => {
9485 if ( message . text !== null && message . text !== undefined && message . say === "api_req_started" ) {
9586 const info : ClineApiReqInfo = JSON . parse ( message . text )
9687 return [ info . cost , info . cancelReason , info . streamingFailedMessage ]
9788 }
89+
9890 return [ undefined , undefined , undefined ]
9991 } , [ message . text , message . say ] )
100- // when resuming task, last wont be api_req_failed but a resume_task message, so api_req_started will show loading spinner. that's why we just remove the last api_req_started that failed without streaming anything
92+
93+ // When resuming task, last wont be api_req_failed but a resume_task
94+ // message, so api_req_started will show loading spinner. That's why we just
95+ // remove the last api_req_started that failed without streaming anything.
10196 const apiRequestFailedMessage =
10297 isLast && lastModifiedMessage ?. ask === "api_req_failed" // if request is retried then the latest message is a api_req_retried
10398 ? lastModifiedMessage ?. text
10499 : undefined
100+
105101 const isCommandExecuting =
106102 isLast && lastModifiedMessage ?. ask === "command" && lastModifiedMessage ?. text ?. includes ( COMMAND_OUTPUT_STRING )
107103
@@ -428,32 +424,6 @@ export const ChatRowContent = ({
428424 />
429425 </ >
430426 )
431- // case "inspectSite":
432- // const isInspecting =
433- // isLast && lastModifiedMessage?.say === "inspect_site_result" && !lastModifiedMessage?.images
434- // return (
435- // <>
436- // <div style={headerStyle}>
437- // {isInspecting ? <ProgressIndicator /> : toolIcon("inspect")}
438- // <span style={{ fontWeight: "bold" }}>
439- // {message.type === "ask" ? (
440- // <>Roo wants to inspect this website:</>
441- // ) : (
442- // <>Roo is inspecting this website:</>
443- // )}
444- // </span>
445- // </div>
446- // <div
447- // style={{
448- // borderRadius: 3,
449- // border: "1px solid var(--vscode-editorGroup-border)",
450- // overflow: "hidden",
451- // backgroundColor: CODE_BLOCK_BG_COLOR,
452- // }}>
453- // <CodeBlock source={`${"```"}shell\n${tool.path}\n${"```"}`} forceWrap={true} />
454- // </div>
455- // </>
456- // )
457427 case "switchMode" :
458428 return (
459429 < >
@@ -501,6 +471,7 @@ export const ChatRowContent = ({
501471 return (
502472 < ReasoningBlock
503473 content = { message . text || "" }
474+ elapsed = { isLast && isStreaming ? Date . now ( ) - message . ts : undefined }
504475 isCollapsed = { reasoningCollapsed }
505476 onToggleCollapse = { ( ) => setReasoningCollapsed ( ! reasoningCollapsed ) }
506477 />
0 commit comments