Skip to content

Commit ced5a66

Browse files
committed
Revert "Remove request content from UI messages (RooCodeInc#8696)"
This reverts commit 4405f5a.
1 parent 7c7c7e0 commit ced5a66

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

src/core/task/Task.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import { RepoPerTaskCheckpointService } from "../../services/checkpoints"
7676

7777
// integrations
7878
import { DiffViewProvider } from "../../integrations/editor/DiffViewProvider"
79-
import { findToolName } from "../../integrations/misc/export-markdown"
79+
import { findToolName, formatContentBlockToMarkdown } from "../../integrations/misc/export-markdown"
8080
import { RooTerminalProcess } from "../../integrations/terminal/types"
8181
import { TerminalRegistry } from "../../integrations/terminal/TerminalRegistry"
8282

@@ -2148,6 +2148,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
21482148
await this.say(
21492149
"api_req_started",
21502150
JSON.stringify({
2151+
request:
2152+
currentUserContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n") +
2153+
"\n\nLoading...",
21512154
apiProtocol,
21522155
}),
21532156
)
@@ -2215,6 +2218,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
22152218
const lastApiReqIndex = findLastIndex(this.clineMessages, (m) => m.say === "api_req_started")
22162219

22172220
this.clineMessages[lastApiReqIndex].text = JSON.stringify({
2221+
request: finalUserContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n"),
22182222
apiProtocol,
22192223
} satisfies ClineApiReqInfo)
22202224

src/core/task/__tests__/Task.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,7 @@ describe("Cline", () => {
714714
tokensOut: 50,
715715
cacheWrites: 0,
716716
cacheReads: 0,
717+
request: "test request",
717718
}),
718719
},
719720
]
@@ -838,6 +839,7 @@ describe("Cline", () => {
838839
tokensOut: 50,
839840
cacheWrites: 0,
840841
cacheReads: 0,
842+
request: "test request",
841843
}),
842844
},
843845
]

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ import { ChatTextArea } from "./ChatTextArea"
4646
import { MAX_IMAGES_PER_MESSAGE } from "./ChatView"
4747
import { useSelectedModel } from "../ui/hooks/useSelectedModel"
4848
import {
49+
ChevronRight,
50+
ChevronDown,
4951
Eye,
5052
FileDiff,
5153
ListTree,
@@ -321,7 +323,11 @@ export const ChatRowContent = ({
321323
getIconSpan("error", errorColor)
322324
)
323325
) : cost !== null && cost !== undefined ? (
324-
getIconSpan("arrow-swap", normalColor)
326+
isExpanded ? (
327+
<ChevronDown className="w-4 shrink-0" />
328+
) : (
329+
<ChevronRight className="w-4 shrink-0" />
330+
)
325331
) : apiRequestFailedMessage ? (
326332
getIconSpan("error", errorColor)
327333
) : (
@@ -353,7 +359,17 @@ export const ChatRowContent = ({
353359
default:
354360
return [null, null]
355361
}
356-
}, [type, isCommandExecuting, message, isMcpServerResponding, apiReqCancelReason, cost, apiRequestFailedMessage, t])
362+
}, [
363+
type,
364+
isCommandExecuting,
365+
message,
366+
isMcpServerResponding,
367+
apiReqCancelReason,
368+
cost,
369+
apiRequestFailedMessage,
370+
t,
371+
isExpanded,
372+
])
357373

358374
const headerStyle: React.CSSProperties = {
359375
display: "flex",
@@ -1083,7 +1099,13 @@ export const ChatRowContent = ({
10831099
? 10
10841100
: 0,
10851101
justifyContent: "space-between",
1086-
}}>
1102+
cursor: "pointer",
1103+
userSelect: "none",
1104+
WebkitUserSelect: "none",
1105+
MozUserSelect: "none",
1106+
msUserSelect: "none",
1107+
}}
1108+
onClick={handleToggleExpand}>
10871109
<div style={{ display: "flex", alignItems: "center", gap: "10px", flexGrow: 1 }}>
10881110
{icon}
10891111
{title}
@@ -1116,6 +1138,17 @@ export const ChatRowContent = ({
11161138
}
11171139
/>
11181140
)}
1141+
1142+
{isExpanded && (
1143+
<div className="ml-6" style={{ marginTop: "10px" }}>
1144+
<CodeAccordian
1145+
code={safeJsonParse<any>(message.text)?.request}
1146+
language="markdown"
1147+
isExpanded={true}
1148+
onToggleExpand={handleToggleExpand}
1149+
/>
1150+
</div>
1151+
)}
11191152
</>
11201153
)
11211154
case "api_req_finished":

0 commit comments

Comments
 (0)