Skip to content

Commit 3af9db8

Browse files
committed
Revert "Remove request content from UI messages (RooCodeInc#8696)"
This reverts commit 4405f5a.
1 parent 28fe008 commit 3af9db8

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
@@ -75,7 +75,7 @@ import { RepoPerTaskCheckpointService } from "../../services/checkpoints"
7575

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

@@ -1859,6 +1859,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
18591859
await this.say(
18601860
"api_req_started",
18611861
JSON.stringify({
1862+
request:
1863+
currentUserContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n") +
1864+
"\n\nLoading...",
18621865
apiProtocol,
18631866
}),
18641867
)
@@ -1904,6 +1907,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
19041907
const lastApiReqIndex = findLastIndex(this.clineMessages, (m) => m.say === "api_req_started")
19051908

19061909
this.clineMessages[lastApiReqIndex].text = JSON.stringify({
1910+
request: finalUserContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n"),
19071911
apiProtocol,
19081912
} satisfies ClineApiReqInfo)
19091913

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)