Skip to content

Commit 6b35107

Browse files
committed
Implementation of code diff for File Write along with Accept and Reject buttons
1 parent aa76262 commit 6b35107

File tree

6 files changed

+227
-178
lines changed

6 files changed

+227
-178
lines changed

packages/core/src/amazonq/webview/ui/apps/cwChatConnector.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@ export class Connector extends BaseConnector {
264264
tabID: tabId,
265265
})
266266

267-
if (!this.onChatAnswerUpdated || !['accept-code-diff', 'reject-code-diff'].includes(action.id)) {
267+
if (
268+
!this.onChatAnswerUpdated ||
269+
!['accept-code-diff', 'reject-code-diff', 'confirm-tool-use'].includes(action.id)
270+
) {
268271
return
269272
}
270273
const answer: ChatItem = {
@@ -297,6 +300,18 @@ export class Connector extends BaseConnector {
297300
},
298301
]
299302
break
303+
case 'confirm-tool-use':
304+
answer.buttons = [
305+
{
306+
keepCardAfterClick: true,
307+
text: 'Confirmed',
308+
id: 'confirmed-tool-use',
309+
status: 'success',
310+
position: 'outside',
311+
disabled: true,
312+
},
313+
]
314+
break
300315
default:
301316
break
302317
}

packages/core/src/codewhispererChat/clients/chat/v0/chat.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ export class ChatSession {
2424
* _showDiffOnFileWrite = Controls whether to show diff view (true) or file context view (false) to the user
2525
*/
2626
private _readFiles: string[] = []
27-
private _filePath: string | undefined
28-
private _tempFilePath: string | undefined
2927
private _toolUse: ToolUse | undefined
3028
private _showDiffOnFileWrite: boolean = false
3129

@@ -61,24 +59,12 @@ export class ChatSession {
6159
public get readFiles(): string[] {
6260
return this._readFiles
6361
}
64-
public get filePath(): string | undefined {
65-
return this._filePath
66-
}
67-
public get tempFilePath(): string | undefined {
68-
return this._tempFilePath
69-
}
7062
public get showDiffOnFileWrite(): boolean {
7163
return this._showDiffOnFileWrite
7264
}
7365
public setShowDiffOnFileWrite(value: boolean) {
7466
this._showDiffOnFileWrite = value
7567
}
76-
public setFilePath(filePath: string | undefined) {
77-
this._filePath = filePath
78-
}
79-
public setTempFilePath(tempFilePath: string | undefined) {
80-
this._tempFilePath = tempFilePath
81-
}
8268
public addToReadFiles(filePath: string) {
8369
this._readFiles.push(filePath)
8470
}

0 commit comments

Comments
 (0)