Skip to content

Commit 5a713ad

Browse files
authored
fix(/dev): conversation id log message is now homogeneous and similar to the customer facing text (aws#5076)
Problem: - How we log conversation ids is not homogeneous Solution: - Make it similiar to the customer facing text
1 parent d357fb9 commit 5a713ad

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ import { placeholder } from '../../../shared/vscode/commands2'
3434
import { EditorContentController } from '../../../amazonq/commons/controllers/contentController'
3535
import { openUrl } from '../../../shared/utilities/vsCodeUtils'
3636
import { getPathsFromZipFilePath } from '../../util/files'
37-
import { examples, newTaskChanges, approachCreation, sessionClosed, updateCode } from '../../userFacingText'
37+
import {
38+
examples,
39+
newTaskChanges,
40+
approachCreation,
41+
sessionClosed,
42+
updateCode,
43+
logWithConversationId,
44+
} from '../../userFacingText'
3845
import { getWorkspaceFoldersByPrefixes } from '../../../shared/utilities/workspaceUtils'
3946

4047
export interface ChatControllerEventEmitters {
@@ -321,7 +328,7 @@ export class FeatureDevController {
321328
private async onApproachGeneration(session: Session, message: string, tabID: string) {
322329
await session.preloader(message)
323330

324-
getLogger().info(`${featureName} conversation id: ${session.conversationId}`)
331+
getLogger().info(logWithConversationId(session.conversationId))
325332

326333
// This is a loading animation
327334
this.messenger.sendAnswer({
@@ -366,7 +373,7 @@ export class FeatureDevController {
366373
* Handle a regular incoming message when a user is in the code generation phase
367374
*/
368375
private async onCodeGeneration(session: Session, message: string, tabID: string) {
369-
getLogger().info(`Q - Dev chat conversation id: ${session.conversationId}`)
376+
getLogger().info(logWithConversationId(session.conversationId))
370377

371378
// lock the UI/show loading bubbles
372379
this.messenger.sendAsyncEventProgress(

packages/core/src/amazonqFeatureDev/controllers/chat/messenger/messenger.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from '../../../views/connector/connector'
2222
import { AppToWebViewMessageDispatcher } from '../../../views/connector/connector'
2323
import { ChatItemAction } from '@aws/mynah-ui'
24+
import { messageWithConversationId } from '../../../userFacingText'
2425

2526
export class Messenger {
2627
public constructor(private readonly dispatcher: AppToWebViewMessageDispatcher) {}
@@ -62,8 +63,6 @@ export class Messenger {
6263
phase?: SessionStatePhase,
6364
conversationId?: string
6465
) {
65-
const conversationIdText = conversationId ? `\n\nConversation ID: **${conversationId}**` : ''
66-
6766
if (retries === 0) {
6867
this.sendAnswer({
6968
type: 'answer',
@@ -90,7 +89,7 @@ export class Messenger {
9089
this.dispatcher.sendErrorMessage(
9190
new ErrorMessage(
9291
`Sorry, we're experiencing an issue on our side. Would you like to try again?`,
93-
errorMessage + conversationIdText,
92+
errorMessage + messageWithConversationId(conversationId),
9493
tabID
9594
)
9695
)
@@ -99,7 +98,7 @@ export class Messenger {
9998
this.dispatcher.sendErrorMessage(
10099
new ErrorMessage(
101100
`Sorry, we're experiencing an issue on our side. Would you like to try again?`,
102-
errorMessage + conversationIdText,
101+
errorMessage + messageWithConversationId(conversationId),
103102
tabID
104103
)
105104
)
@@ -109,7 +108,7 @@ export class Messenger {
109108
this.dispatcher.sendErrorMessage(
110109
new ErrorMessage(
111110
`Sorry, we encountered a problem when processing your request.`,
112-
errorMessage + conversationIdText,
111+
errorMessage + messageWithConversationId(conversationId),
113112
tabID
114113
)
115114
)

packages/core/src/amazonqFeatureDev/userFacingText.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
import { manageAccessGuideURL } from '../amazonq/webview/ui/texts/constants'
77
import { userGuideURL } from '../amazonq/webview/ui/texts/constants'
8+
import { featureName } from './constants'
89

910
export const examples = `
1011
You can use /dev to:
1112
- Add a new feature or logic
12-
- Write tests
13+
- Write tests
1314
- Fix a bug in your project
1415
- Generate a README for a file, folder, or project
1516
@@ -21,3 +22,8 @@ export const updateCode = 'Code has been updated. Would you like to work on anot
2122
export const sessionClosed = 'Your session is now closed.'
2223
export const newTaskChanges = 'What change would you like to make?'
2324
export const uploadCodeError = `Amazon Q is unable to upload workspace artifacts to S3 for feature development. For more information, see the [Amazon Q documentation](${manageAccessGuideURL}) or contact your network or organization administrator.`
25+
26+
// Utils for logging and showing customer facing conversation id text
27+
export const messageWithConversationId = (conversationId?: string) =>
28+
conversationId ? `\n\nConversation ID: **${conversationId}**` : ''
29+
export const logWithConversationId = (conversationId: string) => `${featureName} Conversation ID: ${conversationId}`

0 commit comments

Comments
 (0)