Skip to content

Commit 3ddaaaa

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

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

7070
// integrations
7171
import { DiffViewProvider } from "../../integrations/editor/DiffViewProvider"
72-
import { findToolName } from "../../integrations/misc/export-markdown"
72+
import { findToolName, formatContentBlockToMarkdown } from "../../integrations/misc/export-markdown"
7373
import { RooTerminalProcess } from "../../integrations/terminal/types"
7474
import { TerminalRegistry } from "../../integrations/terminal/TerminalRegistry"
7575

@@ -1849,6 +1849,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
18491849
await this.say(
18501850
"api_req_started",
18511851
JSON.stringify({
1852+
request:
1853+
currentUserContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n") +
1854+
"\n\nLoading...",
18521855
apiProtocol,
18531856
}),
18541857
)
@@ -1888,6 +1891,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
18881891
const lastApiReqIndex = findLastIndex(this.clineMessages, (m) => m.say === "api_req_started")
18891892

18901893
this.clineMessages[lastApiReqIndex].text = JSON.stringify({
1894+
request: finalUserContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n"),
18911895
apiProtocol,
18921896
} satisfies ClineApiReqInfo)
18931897

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",
@@ -1084,7 +1100,13 @@ export const ChatRowContent = ({
10841100
? 10
10851101
: 0,
10861102
justifyContent: "space-between",
1087-
}}>
1103+
cursor: "pointer",
1104+
userSelect: "none",
1105+
WebkitUserSelect: "none",
1106+
MozUserSelect: "none",
1107+
msUserSelect: "none",
1108+
}}
1109+
onClick={handleToggleExpand}>
10881110
<div style={{ display: "flex", alignItems: "center", gap: "10px", flexGrow: 1 }}>
10891111
{icon}
10901112
{title}
@@ -1117,6 +1139,17 @@ export const ChatRowContent = ({
11171139
}
11181140
/>
11191141
)}
1142+
1143+
{isExpanded && (
1144+
<div className="ml-6" style={{ marginTop: "10px" }}>
1145+
<CodeAccordian
1146+
code={safeJsonParse<any>(message.text)?.request}
1147+
language="markdown"
1148+
isExpanded={true}
1149+
onToggleExpand={handleToggleExpand}
1150+
/>
1151+
</div>
1152+
)}
11201153
</>
11211154
)
11221155
case "api_req_finished":

0 commit comments

Comments
 (0)