Skip to content

Commit 3aa5b3f

Browse files
committed
Allow the user to send context with approval or rejection
1 parent fc688bb commit 3aa5b3f

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

src/core/Cline.ts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,35 +1085,23 @@ export class Cline {
10851085
const askApproval = async (type: ClineAsk, partialMessage?: string) => {
10861086
const { response, text, images } = await this.ask(type, partialMessage, false)
10871087
if (response !== "yesButtonClicked") {
1088-
if (response === "messageResponse") {
1088+
// Handle both messageResponse and noButtonClicked with text
1089+
if (text) {
10891090
await this.say("user_feedback", text, images)
10901091
pushToolResult(
10911092
formatResponse.toolResult(formatResponse.toolDeniedWithFeedback(text), images),
10921093
)
1093-
// this.userMessageContent.push({
1094-
// type: "text",
1095-
// text: `${toolDescription()}`,
1096-
// })
1097-
// this.toolResults.push({
1098-
// type: "tool_result",
1099-
// tool_use_id: toolUseId,
1100-
// content: this.formatToolResponseWithImages(
1101-
// await this.formatToolDeniedFeedback(text),
1102-
// images
1103-
// ),
1104-
// })
1105-
this.didRejectTool = true
1106-
return false
1094+
} else {
1095+
pushToolResult(formatResponse.toolDenied())
11071096
}
1108-
pushToolResult(formatResponse.toolDenied())
1109-
// this.toolResults.push({
1110-
// type: "tool_result",
1111-
// tool_use_id: toolUseId,
1112-
// content: await this.formatToolDenied(),
1113-
// })
11141097
this.didRejectTool = true
11151098
return false
11161099
}
1100+
// Handle yesButtonClicked with text
1101+
if (text) {
1102+
await this.say("user_feedback", text, images)
1103+
pushToolResult(formatResponse.toolResult(formatResponse.toolApprovedWithFeedback(text), images))
1104+
}
11171105
return true
11181106
}
11191107

src/core/prompts/responses.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export const formatResponse = {
88
toolDeniedWithFeedback: (feedback?: string) =>
99
`The user denied this operation and provided the following feedback:\n<feedback>\n${feedback}\n</feedback>`,
1010

11+
toolApprovedWithFeedback: (feedback?: string) =>
12+
`The user approved this operation and provided the following context:\n<feedback>\n${feedback}\n</feedback>`,
13+
1114
toolError: (error?: string) => `The tool execution failed with the following error:\n<error>\n${error}\n</error>`,
1215

1316
noToolsUsed: () =>

0 commit comments

Comments
 (0)