File tree Expand file tree Collapse file tree 9 files changed +30
-6
lines changed
amazonq/src/app/amazonqScan/chat/controller
amazonqDoc/controllers/chat
amazonqFeatureDev/controllers/chat
amazonqGumby/chat/controller Expand file tree Collapse file tree 9 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,10 @@ export class ScanController {
108
108
interactionType : data . vote ,
109
109
} )
110
110
} )
111
+
112
+ AuthUtil . instance . regionProfileManager . onDidChangeRegionProfile ( ( ) => {
113
+ this . sessionStorage . removeActiveTab ( )
114
+ } )
111
115
}
112
116
113
117
private async tabOpened ( message : any ) {
Original file line number Diff line number Diff line change @@ -35,4 +35,8 @@ export abstract class BaseChatSessionStorage<T extends { isAuthenticating: boole
35
35
public deleteSession ( tabID : string ) {
36
36
this . sessions . delete ( tabID )
37
37
}
38
+
39
+ public deleteAllSessions ( ) {
40
+ this . sessions . clear ( )
41
+ }
38
42
}
Original file line number Diff line number Diff line change @@ -113,6 +113,9 @@ export class DocController {
113
113
this . chatControllerMessageListeners . openDiff . event ( async ( data ) => {
114
114
return await this . openDiff ( data )
115
115
} )
116
+ AuthUtil . instance . regionProfileManager . onDidChangeRegionProfile ( ( ) => {
117
+ this . sessionStorage . deleteAllSessions ( )
118
+ } )
116
119
}
117
120
118
121
/** Prompts user to choose a folder in current workspace for README creation/update.
Original file line number Diff line number Diff line change @@ -203,6 +203,9 @@ export class FeatureDevController {
203
203
this . chatControllerMessageListeners . storeCodeResultMessageId . event ( async ( data ) => {
204
204
return await this . storeCodeResultMessageId ( data )
205
205
} )
206
+ AuthUtil . instance . regionProfileManager . onDidChangeRegionProfile ( ( ) => {
207
+ this . sessionStorage . deleteAllSessions ( )
208
+ } )
206
209
}
207
210
208
211
private async processChatItemVotedMessage ( tabId : string , vote : string ) {
Original file line number Diff line number Diff line change @@ -147,6 +147,10 @@ export class GumbyController {
147
147
this . chatControllerMessageListeners . errorThrown . event ( ( data ) => {
148
148
return this . handleError ( data )
149
149
} )
150
+
151
+ AuthUtil . instance . regionProfileManager . onDidChangeRegionProfile ( ( ) => {
152
+ this . sessionStorage . removeActiveTab ( )
153
+ } )
150
154
}
151
155
152
156
private async tabOpened ( message : any ) {
Original file line number Diff line number Diff line change @@ -202,6 +202,10 @@ export class TestController {
202
202
return this . openDiff ( data )
203
203
}
204
204
} )
205
+
206
+ AuthUtil . instance . regionProfileManager . onDidChangeRegionProfile ( ( ) => {
207
+ this . sessionStorage . removeActiveTab ( )
208
+ } )
205
209
}
206
210
207
211
/**
Original file line number Diff line number Diff line change 6
6
7
7
import { Session } from '../session/session'
8
8
import { getLogger } from '../../../shared/logger/logger'
9
- import { AuthUtil } from '../../../codewhisperer/util/authUtil'
10
9
11
10
export class SessionNotFoundError extends Error { }
12
11
@@ -15,11 +14,7 @@ export class ChatSessionManager {
15
14
private activeSession : Session | undefined
16
15
private isInProgress : boolean = false
17
16
18
- constructor ( ) {
19
- AuthUtil . instance . regionProfileManager . onDidChangeRegionProfile ( ( ) => {
20
- this . removeActiveTab ( )
21
- } )
22
- }
17
+ constructor ( ) { }
23
18
24
19
public static get Instance ( ) {
25
20
return this . _instance || ( this . _instance = new this ( ) )
Original file line number Diff line number Diff line change @@ -268,6 +268,9 @@ export class ChatController {
268
268
this . chatControllerMessageListeners . processFileClick . onMessage ( ( data ) => {
269
269
return this . processFileClickMessage ( data )
270
270
} )
271
+ AuthUtil . instance . regionProfileManager . onDidChangeRegionProfile ( ( ) => {
272
+ this . sessionStorage . deleteAllSessions ( )
273
+ } )
271
274
}
272
275
273
276
private registerUserPromptsWatcher ( ) {
Original file line number Diff line number Diff line change @@ -23,4 +23,8 @@ export class ChatSessionStorage {
23
23
public deleteSession ( tabID : string ) {
24
24
this . sessions . delete ( tabID )
25
25
}
26
+
27
+ public deleteAllSessions ( ) {
28
+ this . sessions . clear ( )
29
+ }
26
30
}
You can’t perform that action at this time.
0 commit comments