Skip to content

Commit

Permalink
fix(dev): conditional for stop code gen on async event aws#5896
Browse files Browse the repository at this point in the history
## Problem
The function onAsyncEventProgress its reused for both Gumby and Dev
feature, which enabled for both (not the expected scenario).

## Solution
Added a condition to prevent and only enable for Dev.
  • Loading branch information
tverney authored Oct 30, 2024
1 parent f806ae0 commit 9c89c53
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Amazon Q /dev: fix for stop button showing for Code Transformation"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ interface ChatPayload {
export interface ConnectorProps {
sendMessageToExtension: (message: ExtensionMessage) => void
onMessageReceived?: (tabID: string, messageData: any, needToShowAPIDocsTab: boolean) => void
onAsyncEventProgress: (tabID: string, inProgress: boolean, message: string) => void
onAsyncEventProgress: (
tabID: string,
inProgress: boolean,
message: string,
messageId: string | undefined,
enableStopAction: boolean
) => void
onChatAnswerReceived?: (tabID: string, message: ChatItem, messageData: any) => void
sendFeedback?: (tabId: string, feedbackPayload: FeedbackPayload) => void | undefined
onError: (tabID: string, message: string, title: string) => void
Expand Down Expand Up @@ -246,7 +252,14 @@ export class Connector {
}

if (messageData.type === 'asyncEventProgressMessage') {
this.onAsyncEventProgress(messageData.tabID, messageData.inProgress, messageData.message ?? undefined)
const enableStopAction = true
this.onAsyncEventProgress(
messageData.tabID,
messageData.inProgress,
messageData.message ?? undefined,
messageData.messageId ?? undefined,
enableStopAction
)
return
}

Expand Down
11 changes: 9 additions & 2 deletions packages/core/src/amazonq/webview/ui/apps/gumbyChatConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ import { ChatPayload } from '../connector'
export interface ConnectorProps {
sendMessageToExtension: (message: ExtensionMessage) => void
onMessageReceived?: (tabID: string, messageData: any, needToShowAPIDocsTab: boolean) => void
onAsyncEventProgress: (tabID: string, inProgress: boolean, message: string, messageId: string) => void
onAsyncEventProgress: (
tabID: string,
inProgress: boolean,
message: string,
messageId: string,
enableStopAction: boolean
) => void
onChatAnswerReceived?: (tabID: string, message: ChatItem, messageData: any) => void
onChatAnswerUpdated?: (tabID: string, message: ChatItem) => void
onQuickHandlerCommand: (tabID: string, command: string, eventId?: string) => void
Expand Down Expand Up @@ -196,7 +202,8 @@ export class Connector {
messageData.tabID,
messageData.inProgress,
messageData.message,
messageData.messageId
messageData.messageId,
false
)
break
case 'authNeededException':
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/amazonq/webview/ui/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@ export const createMynahUI = (
tabID: string,
inProgress: boolean,
message: string | undefined,
messageId: string | undefined = undefined
messageId: string | undefined = undefined,
enableStopAction: boolean = false
) => {
if (inProgress) {
mynahUI.updateStore(tabID, {
loadingChat: true,
promptInputDisabledState: true,
cancelButtonWhenLoading: true,
cancelButtonWhenLoading: enableStopAction,
})

if (message && messageId) {
Expand Down

0 comments on commit 9c89c53

Please sign in to comment.