Skip to content

Commit a908195

Browse files
ruotingxruotingx
andauthored
feat(amazonq): env var change for JupyterLab conversation history on refresh support (aws#2395)
use SAGEMAKER_APP_TYPE_LOWERCASE env var Co-authored-by: ruotingx <[email protected]>
1 parent 4ce9d8f commit a908195

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tabBarController.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { ChatHistoryActionType } from '../../shared/telemetry/types'
1515
import { TelemetryService } from '../../shared/telemetry/telemetryService'
1616
import { URI } from 'vscode-uri'
1717

18+
const JUPYTERLAB_APP_TYPE_VALUE = 'jupyterlab'
19+
1820
describe('TabBarController', () => {
1921
let testFeatures: TestFeatures
2022
let chatHistoryDb: ChatDatabase
@@ -50,7 +52,7 @@ describe('TabBarController', () => {
5052
afterEach(() => {
5153
sinon.restore()
5254
clock.restore()
53-
delete process.env.JUPYTER_LAB // Clean up JupyterLab environment variables
55+
delete process.env.SAGEMAKER_APP_TYPE_LOWERCASE // Clean up JupyterLab environment variables
5456
testFeatures.dispose()
5557
})
5658

@@ -563,7 +565,7 @@ describe('TabBarController', () => {
563565

564566
it('should allow multiple loads in JupyterLab environment', async () => {
565567
// Set JupyterLab environment
566-
process.env.JUPYTER_LAB = 'true'
568+
process.env.SAGEMAKER_APP_TYPE_LOWERCASE = JUPYTERLAB_APP_TYPE_VALUE
567569

568570
const mockTabs = [{ historyId: 'history1', conversations: [{ messages: [] }] }] as unknown as Tab[]
569571
;(chatHistoryDb.getOpenTabs as sinon.SinonStub).returns(mockTabs)

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tabBarController.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { ChatHistoryActionType } from '../../shared/telemetry/types'
2222
import { CancellationError } from '@aws/lsp-core'
2323

2424
const MaxRestoredHistoryMessages = 250
25+
const JUPYTERLAB_APP_TYPE_VALUE = 'jupyterlab'
2526

2627
/**
2728
* Controller for managing chat history and export functionality.
@@ -344,9 +345,9 @@ export class TabBarController {
344345
*/
345346
private isJupyterLabEnvironment(): boolean {
346347
try {
347-
return process.env.JUPYTER_LAB === 'true'
348+
return process.env.SAGEMAKER_APP_TYPE_LOWERCASE === JUPYTERLAB_APP_TYPE_VALUE
348349
} catch (error) {
349-
this.#features.logging.error(`Failed to read JUPYTER_LAB environment variable: ${error}`)
350+
this.#features.logging.error(`Failed to read SAGEMAKER_APP_TYPE_LOWERCASE environment variable: ${error}`)
350351
return false
351352
}
352353
}

0 commit comments

Comments
 (0)