Skip to content

Commit 3b20744

Browse files
authored
Merge pull request #5675 from tverney/feature/stop-progress-status
feat(dev): Stop code generation action
2 parents 871b894 + c7bf2b1 commit 3b20744

File tree

18 files changed

+389
-115
lines changed

18 files changed

+389
-115
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Amazon Q /dev: Add stop generation action"
4+
}

packages/core/package.nls.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@
299299
"AWS.amazonq.featureDev.pillText.generatingCode": "Generating code...",
300300
"AWS.amazonq.featureDev.pillText.requestingChanges": "Requesting changes ...",
301301
"AWS.amazonq.featureDev.pillText.insertCode": "Accept code",
302+
"AWS.amazonq.featureDev.pillText.stoppingCodeGeneration": "Stopping code generation...",
302303
"AWS.amazonq.featureDev.pillText.sendFeedback": "Send feedback",
303304
"AWS.amazonq.featureDev.pillText.selectFiles": "Select files for context",
304305
"AWS.amazonq.featureDev.pillText.retry": "Retry",
@@ -315,7 +316,7 @@
315316
"AWS.amazonq.featureDev.answer.sessionClosed": "Okay, I've ended this chat session. You can open a new tab to chat or start another workflow.",
316317
"AWS.amazonq.featureDev.answer.newTaskChanges": "What new task would you like to work on?",
317318
"AWS.amazonq.featureDev.placeholder.chatInputDisabled": "Chat input is disabled",
318-
"AWS.amazonq.featureDev.placeholder.additionalImprovements": "Choose an option to proceed",
319+
"AWS.amazonq.featureDev.placeholder.additionalImprovements": "Describe your task or issue in detail",
319320
"AWS.amazonq.featureDev.placeholder.feedback": "Provide feedback or comments",
320321
"AWS.amazonq.featureDev.placeholder.describe": "Describe your task or issue in detail",
321322
"AWS.amazonq.featureDev.placeholder.sessionClosed": "Open a new chat tab to continue"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ export class Connector {
280280
this.sendMessageToExtension({
281281
tabID: tabID,
282282
command: 'stop-response',
283+
tabType: 'featuredev',
283284
})
284285
}
285286

packages/core/src/amazonq/webview/ui/connector.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,17 @@ export class Connector {
176176
this.gumbyChatConnector.transform(tabID)
177177
}
178178

179+
onStopChatResponse = (tabID: string): void => {
180+
switch (this.tabsStorage.getTab(tabID)?.type) {
181+
case 'featuredev':
182+
this.featureDevChatConnector.onStopChatResponse(tabID)
183+
break
184+
case 'cwc':
185+
this.cwChatConnector.onStopChatResponse(tabID)
186+
break
187+
}
188+
}
189+
179190
handleMessageReceive = async (message: MessageEvent): Promise<void> => {
180191
if (message.data === undefined) {
181192
return
@@ -457,17 +468,6 @@ export class Connector {
457468
}
458469
}
459470

460-
onStopChatResponse = (tabID: string): void => {
461-
switch (this.tabsStorage.getTab(tabID)?.type) {
462-
case 'featuredev':
463-
this.featureDevChatConnector.onStopChatResponse(tabID)
464-
break
465-
case 'cwc':
466-
this.cwChatConnector.onStopChatResponse(tabID)
467-
break
468-
}
469-
}
470-
471471
sendFeedback = (tabId: string, feedbackPayload: FeedbackPayload): void | undefined => {
472472
switch (this.tabsStorage.getTab(tabId)?.type) {
473473
case 'featuredev':

packages/core/src/amazonq/webview/ui/followUps/handler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class FollowUpInteractionHandler {
4646
if (followUp.prompt !== undefined) {
4747
this.mynahUI.updateStore(tabID, {
4848
loadingChat: true,
49+
cancelButtonWhenLoading: false,
4950
promptInputDisabledState: true,
5051
})
5152
this.mynahUI.addChatItem(tabID, {

packages/core/src/amazonq/webview/ui/main.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export const createMynahUI = (
197197
mynahUI.updateStore(tabID, {
198198
loadingChat: true,
199199
promptInputDisabledState: true,
200+
cancelButtonWhenLoading: true,
200201
})
201202

202203
if (message && messageId) {
@@ -307,6 +308,7 @@ export const createMynahUI = (
307308
) {
308309
mynahUI.updateStore(tabID, {
309310
loadingChat: true,
311+
cancelButtonWhenLoading: false,
310312
promptInputDisabledState: true,
311313
})
312314

@@ -462,6 +464,13 @@ export const createMynahUI = (
462464
onTabRemove: connector.onTabRemove,
463465
onTabChange: connector.onTabChange,
464466
// TODO: update mynah-ui this type doesn't seem correct https://github.com/aws/mynah-ui/blob/3777a39eb534a91fd6b99d6cf421ce78ee5c7526/src/main.ts#L372
467+
onStopChatResponse: (tabID: string) => {
468+
mynahUI.updateStore(tabID, {
469+
loadingChat: false,
470+
promptInputDisabledState: false,
471+
})
472+
connector.onStopChatResponse(tabID)
473+
},
465474
onChatPrompt: (tabID: string, prompt: ChatPrompt, eventId: string | undefined) => {
466475
if ((prompt.prompt ?? '') === '' && (prompt.command ?? '') === '') {
467476
return

packages/core/src/amazonq/webview/ui/messages/controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export class MessageController {
7676

7777
this.mynahUI.updateStore(selectedTab.id, {
7878
loadingChat: true,
79+
cancelButtonWhenLoading: false,
7980
promptInputDisabledState: true,
8081
})
8182
this.mynahUI.addChatItem(selectedTab.id, message)
@@ -107,6 +108,7 @@ export class MessageController {
107108

108109
this.mynahUI.updateStore(newTabID, {
109110
loadingChat: true,
111+
cancelButtonWhenLoading: false,
110112
promptInputDisabledState: true,
111113
})
112114

packages/core/src/amazonq/webview/ui/messages/handler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class TextMessageHandler {
3636

3737
this.mynahUI.updateStore(tabID, {
3838
loadingChat: true,
39+
cancelButtonWhenLoading: false,
3940
promptInputDisabledState: true,
4041
})
4142

packages/core/src/amazonq/webview/ui/quickActions/handler.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class QuickActionHandler {
7979
if (this.tabsStorage.getTab(affectedTabId)?.type !== 'unknown') {
8080
affectedTabId = this.mynahUI.updateStore('', {
8181
loadingChat: true,
82+
cancelButtonWhenLoading: false,
8283
})
8384
}
8485

@@ -103,6 +104,7 @@ export class QuickActionHandler {
103104
// disable chat prompt
104105
this.mynahUI.updateStore(affectedTabId, {
105106
loadingChat: true,
107+
cancelButtonWhenLoading: false,
106108
})
107109

108110
this.connector.transform(affectedTabId)
@@ -161,6 +163,7 @@ export class QuickActionHandler {
161163
this.mynahUI.updateStore(affectedTabId, {
162164
loadingChat: true,
163165
promptInputDisabledState: true,
166+
cancelButtonWhenLoading: false,
164167
})
165168

166169
void this.connector.requestGenerativeAIAnswer(affectedTabId, '', {

packages/core/src/amazonq/webview/ui/texts/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const uiComponentsTexts = {
1919
save: 'Save',
2020
cancel: 'Cancel',
2121
submit: 'Submit',
22-
stopGenerating: 'Stop generating',
22+
stopGenerating: 'Stop',
2323
copyToClipboard: 'Copied to clipboard',
2424
noMoreTabsTooltip: 'You can only open ten conversation tabs at a time.',
2525
codeSuggestionWithReferenceTitle: 'Some suggestions contain code with references.',

0 commit comments

Comments
 (0)