mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge pull request #1748 from dcbartlett/feature/ENG-107_send_input_on_mode_switch
Feature/ENG_107 Send input on mode switch
This commit is contained in:
commit
95e1555361
7 changed files with 47 additions and 5 deletions
5
.changeset/silly-cats-appear.md
Normal file
5
.changeset/silly-cats-appear.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"claude-dev": minor
|
||||
---
|
||||
|
||||
Add new ability to send message that is in Input field during Plan/Act Mode Change to Act.
|
||||
|
|
@ -2716,14 +2716,15 @@ export class Cline {
|
|||
this.isAwaitingPlanResponse = false
|
||||
|
||||
if (this.didRespondToPlanAskBySwitchingMode) {
|
||||
// await this.say("user_feedback", text ?? "", images)
|
||||
pushToolResult(
|
||||
formatResponse.toolResult(
|
||||
`[The user has switched to ACT MODE, so you may now proceed with the task.]`,
|
||||
images,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
}
|
||||
|
||||
if (text) {
|
||||
await this.say("user_feedback", text ?? "", images)
|
||||
pushToolResult(formatResponse.toolResult(`<user_message>\n${text}\n</user_message>`, images))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -626,7 +626,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
await this.postMessageToWebview({
|
||||
type: "invoke",
|
||||
invoke: "sendMessage",
|
||||
text: "[Proceeding with the task...]",
|
||||
text: message.chatContent?.message || "[Proceeding with the task...]",
|
||||
images: message.chatContent?.images,
|
||||
})
|
||||
} else {
|
||||
this.cancelTask()
|
||||
|
|
|
|||
4
src/shared/ChatContent.ts
Normal file
4
src/shared/ChatContent.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export interface ChatContent {
|
||||
message?: string
|
||||
images?: string[]
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ import { ApiConfiguration } from "./api"
|
|||
import { AutoApprovalSettings } from "./AutoApprovalSettings"
|
||||
import { BrowserSettings } from "./BrowserSettings"
|
||||
import { ChatSettings } from "./ChatSettings"
|
||||
import { ChatContent } from "./ChatContent"
|
||||
|
||||
export interface WebviewMessage {
|
||||
type:
|
||||
|
|
@ -53,6 +54,7 @@ export interface WebviewMessage {
|
|||
autoApprovalSettings?: AutoApprovalSettings
|
||||
browserSettings?: BrowserSettings
|
||||
chatSettings?: ChatSettings
|
||||
chatContent?: ChatContent
|
||||
|
||||
// For toggleToolAutoApprove
|
||||
serverName?: string
|
||||
|
|
|
|||
|
|
@ -28,7 +28,13 @@ describe("Chat Integration Tests", () => {
|
|||
vscode.postMessage({ type: 'newTask', text: message.text });
|
||||
break;
|
||||
case 'toggleMode':
|
||||
vscode.postMessage({ type: 'chatSettings', chatSettings: { mode: 'act' } });
|
||||
vscode.postMessage({
|
||||
type: 'chatSettings',
|
||||
chatSettings: { mode: 'act' },
|
||||
chatContent: {
|
||||
message: "message test",
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'invoke':
|
||||
if (message.invoke === 'primaryButtonClick') {
|
||||
|
|
@ -92,6 +98,25 @@ describe("Chat Integration Tests", () => {
|
|||
assert.equal(stateChange.chatSettings.mode, "act")
|
||||
})
|
||||
|
||||
it("should toggle between plan and act modes with messages", async () => {
|
||||
// Set up state change listener
|
||||
const stateChangePromise = new Promise<any>((resolve) => {
|
||||
panel.webview.onDidReceiveMessage((message) => {
|
||||
if (message.type === "chatSettings") {
|
||||
resolve(message)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// Trigger mode toggle
|
||||
await panel.webview.postMessage({ type: "toggleMode" })
|
||||
|
||||
// Verify mode changed
|
||||
const stateChange = await stateChangePromise
|
||||
assert.equal(stateChange.chatSettings.mode, "act")
|
||||
assert.equal(stateChange.chatContent.message, "message test")
|
||||
})
|
||||
|
||||
it("should handle tool approval flow", async () => {
|
||||
// Set up approval listener
|
||||
const approvalPromise = new Promise<any>((resolve) => {
|
||||
|
|
|
|||
|
|
@ -616,13 +616,17 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
|||
chatSettings: {
|
||||
mode: newMode,
|
||||
},
|
||||
chatContent: {
|
||||
message: inputValue.trim() ? inputValue : undefined,
|
||||
images: selectedImages.length > 0 ? selectedImages : undefined,
|
||||
},
|
||||
})
|
||||
// Focus the textarea after mode toggle with slight delay
|
||||
setTimeout(() => {
|
||||
textAreaRef.current?.focus()
|
||||
}, 100)
|
||||
}, changeModeDelay)
|
||||
}, [chatSettings.mode, showModelSelector, submitApiConfig])
|
||||
}, [chatSettings.mode, showModelSelector, submitApiConfig, inputValue, selectedImages])
|
||||
|
||||
useShortcut("Meta+Shift+a", onModeToggle, { disableTextInputs: false }) // important that we don't disable the text input here
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue