Skip to content

Commit d585e23

Browse files
author
Viktor Shesternyak
committed
fix(amazonq): /doc remove retry folowup button to make it in synch with vscode plugin. Instead propose user New Task and End session buttons
1 parent 8402123 commit d585e23

File tree

3 files changed

+20
-65
lines changed

3 files changed

+20
-65
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Amazon Q /doc: remove retry button and instead propose user New Task and End Session buttons to make it in sync with vscode plugin"
4+
}

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqDoc/controller/DocController.kt

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,9 @@ class DocController(
404404

405405
else -> {
406406
logger.error { "$FEATURE_NAME: OpenDiff event is received for a conversation that has ${session.sessionState.phase} phase" }
407-
messenger.sendError(
407+
messenger.sendErrorToUser(
408408
tabId = message.tabId,
409409
errMessage = message("amazonqFeatureDev.exception.open_diff_failed"),
410-
retries = 0,
411410
conversationId = session.conversationIdUnsafe
412411
)
413412
}
@@ -506,10 +505,9 @@ class DocController(
506505
)
507506
} catch (err: Exception) {
508507
val message = createUserFacingErrorMessage("Failed to insert code changes: ${err.message}")
509-
messenger.sendError(
508+
messenger.sendErrorToUser(
510509
tabId = tabId,
511510
errMessage = message ?: message("amazonqFeatureDev.exception.insert_code_failed"),
512-
retries = retriesRemaining(session),
513511
conversationId = session?.conversationIdUnsafe
514512
)
515513
}
@@ -587,10 +585,9 @@ class DocController(
587585

588586
when (err) {
589587
is RepoSizeError -> {
590-
messenger.sendError(
588+
messenger.sendErrorToUser(
591589
tabId = tabId,
592590
errMessage = err.message,
593-
retries = retriesRemaining(session),
594591
conversationId = session?.conversationIdUnsafe
595592
)
596593
messenger.sendSystemPrompt(
@@ -606,10 +603,9 @@ class DocController(
606603
}
607604

608605
is ZipFileError -> {
609-
messenger.sendError(
606+
messenger.sendErrorToUser(
610607
tabId = tabId,
611608
errMessage = err.message,
612-
retries = 0,
613609
conversationId = session?.conversationIdUnsafe
614610
)
615611
}
@@ -701,10 +697,9 @@ class DocController(
701697
else -> message("amazonqFeatureDev.error_text")
702698
}
703699

704-
messenger.sendError(
700+
messenger.sendErrorToUser(
705701
tabId = tabId,
706702
errMessage = defaultMessage,
707-
retries = retriesRemaining(session),
708703
conversationId = session?.conversationIdUnsafe
709704
)
710705
}
@@ -802,9 +797,12 @@ class DocController(
802797
) {
803798
return
804799
}
805-
806800
if (filePaths.isEmpty() && deletedFiles.isEmpty()) {
807-
handleEmptyFiles(followUpMessage, session)
801+
messenger.sendErrorToUser(
802+
followUpMessage.tabId,
803+
message("amazonqDoc.error.generating"),
804+
conversationId = session.conversationId
805+
)
808806
return
809807
}
810808

@@ -859,37 +857,6 @@ class DocController(
859857
}
860858
}
861859

862-
private suspend fun handleEmptyFiles(
863-
message: IncomingDocMessage.FollowupClicked,
864-
session: DocSession,
865-
) {
866-
messenger.sendAnswer(
867-
message = message("amazonqDoc.error.generating"),
868-
messageType = DocMessageType.Answer,
869-
tabId = message.tabId,
870-
canBeVoted = true
871-
)
872-
873-
messenger.sendAnswer(
874-
messageType = DocMessageType.SystemPrompt,
875-
tabId = message.tabId,
876-
followUp = if (retriesRemaining(session) > 0) {
877-
listOf(
878-
FollowUp(
879-
pillText = message("amazonqFeatureDev.follow_up.retry"),
880-
type = FollowUpTypes.RETRY,
881-
status = FollowUpStatusType.Warning
882-
)
883-
)
884-
} else {
885-
emptyList()
886-
}
887-
)
888-
889-
// Lock the chat input until they explicitly click retry
890-
messenger.sendChatInputEnabledMessage(tabId = message.tabId, enabled = false)
891-
}
892-
893860
private suspend fun retryRequests(tabId: String) {
894861
var session: DocSession? = null
895862
docGenerationTask = DocGenerationTask()

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqDoc/controller/DocControllerExtensions.kt

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ package software.aws.toolkits.jetbrains.services.amazonqDoc.controller
66
import com.intellij.notification.NotificationAction
77
import software.aws.toolkits.jetbrains.services.amazonqDoc.inProgress
88
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.DocMessageType
9-
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.FollowUp
10-
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.FollowUpStatusType
11-
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.FollowUpTypes
129
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendAnswer
1310
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendAsyncEventProgress
1411
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendChatInputEnabledMessage
1512
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendCodeResult
13+
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendErrorToUser
1614
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendSystemPrompt
1715
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendUpdatePlaceholder
1816
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendUpdatePromptProgress
@@ -73,26 +71,12 @@ suspend fun DocController.onCodeGeneration(session: DocSession, message: String,
7371

7472
// Atm this is the only possible path as codegen is mocked to return empty.
7573
if (filePaths.size or deletedFiles.size == 0) {
76-
messenger.sendAnswer(
77-
tabId = tabId,
78-
messageType = DocMessageType.Answer,
79-
message = message("amazonqFeatureDev.code_generation.no_file_changes")
80-
)
81-
messenger.sendSystemPrompt(
82-
tabId = tabId,
83-
followUp = if (retriesRemaining(session) > 0) {
84-
listOf(
85-
FollowUp(
86-
pillText = message("amazonqFeatureDev.follow_up.retry"),
87-
type = FollowUpTypes.RETRY,
88-
status = FollowUpStatusType.Warning
89-
)
90-
)
91-
} else {
92-
emptyList()
93-
}
74+
messenger.sendErrorToUser(
75+
tabId,
76+
message("amazonqDoc.error.generating"),
77+
conversationId = session.conversationId
9478
)
95-
messenger.sendChatInputEnabledMessage(tabId = tabId, enabled = false) // Lock chat input until retry is clicked.
79+
9680
return
9781
}
9882

0 commit comments

Comments
 (0)