diff --git a/.github/workflows/actions/test-and-build/action.yaml b/.github/workflows/actions/test-and-build/action.yaml index 2b9438281..85703a1ea 100644 --- a/.github/workflows/actions/test-and-build/action.yaml +++ b/.github/workflows/actions/test-and-build/action.yaml @@ -70,6 +70,8 @@ runs: shell: bash - name: Run Tests + env: + NODE_OPTIONS: "--max_old_space_size=4096" run: | npm run test shell: bash diff --git a/src/mdbExtensionController.ts b/src/mdbExtensionController.ts index fb6d51d39..cc1380f5b 100644 --- a/src/mdbExtensionController.ts +++ b/src/mdbExtensionController.ts @@ -109,6 +109,7 @@ export default class MDBExtensionController implements vscode.Disposable { new PlaygroundDiagnosticsCodeActionProvider(); this._participantController = new ParticipantController({ connectionController: this._connectionController, + storageController: this._storageController, }); this._playgroundController = new PlaygroundController({ connectionController: this._connectionController, diff --git a/src/participant/participant.ts b/src/participant/participant.ts index 44992c24b..ded24c582 100644 --- a/src/participant/participant.ts +++ b/src/participant/participant.ts @@ -3,6 +3,8 @@ import * as vscode from 'vscode'; import { createLogger } from '../logging'; import type ConnectionController from '../connectionController'; import EXTENSION_COMMANDS from '../commands'; +import type { StorageController } from '../storage'; +import { StorageVariables } from '../storage'; import { GenericPrompt } from './prompts/generic'; import { CHAT_PARTICIPANT_ID } from './constants'; import { QueryPrompt } from './prompts/query'; @@ -40,14 +42,18 @@ export class ParticipantController { _participant?: vscode.ChatParticipant; _chatResult: ChatResult; _connectionController: ConnectionController; + _storageController: StorageController; constructor({ connectionController, + storageController, }: { connectionController: ConnectionController; + storageController: StorageController; }) { this._chatResult = { metadata: { command: '' } }; this._connectionController = connectionController; + this._storageController = storageController; } createParticipant(context: vscode.ExtensionContext) { @@ -278,6 +284,23 @@ export class ParticipantController { stream: vscode.ChatResponseStream, token: vscode.CancellationToken ): Promise { + const hasBeenShownWelcomeMessageAlready = !!this._storageController.get( + StorageVariables.COPILOT_HAS_BEEN_SHOWN_WELCOME_MESSAGE + ); + + if (!hasBeenShownWelcomeMessageAlready) { + stream.markdown( + vscode.l10n.t(` + Welcome to MongoDB Participant!\n\n + Interact with your MongoDB clusters and generate MongoDB-related code more efficiently with intelligent AI-powered feature, available today in the MongoDB extension.\n\n + Please see our [FAQ](https://www.mongodb.com/docs/generative-ai-faq/) for more information.`) + ); + void this._storageController.update( + StorageVariables.COPILOT_HAS_BEEN_SHOWN_WELCOME_MESSAGE, + true + ); + } + if (request.command === 'query') { this._chatResult = await this.handleQueryRequest({ request, diff --git a/src/storage/storageController.ts b/src/storage/storageController.ts index 3ae1a71ec..7a2ba780b 100644 --- a/src/storage/storageController.ts +++ b/src/storage/storageController.ts @@ -12,6 +12,7 @@ export enum StorageVariables { GLOBAL_ANONYMOUS_ID = 'GLOBAL_ANONYMOUS_ID', // Only exists on workspaceState. WORKSPACE_SAVED_CONNECTIONS = 'WORKSPACE_SAVED_CONNECTIONS', + COPILOT_HAS_BEEN_SHOWN_WELCOME_MESSAGE = 'COPILOT_HAS_BEEN_SHOWN_WELCOME_MESSAGE', } // Typically variables default to 'GLOBAL' scope. @@ -52,6 +53,7 @@ interface StorageVariableContents { [StorageVariables.GLOBAL_HAS_BEEN_SHOWN_INITIAL_VIEW]: boolean; [StorageVariables.GLOBAL_SAVED_CONNECTIONS]: ConnectionsFromStorage; [StorageVariables.WORKSPACE_SAVED_CONNECTIONS]: ConnectionsFromStorage; + [StorageVariables.COPILOT_HAS_BEEN_SHOWN_WELCOME_MESSAGE]: boolean; } type StoredVariableName = keyof StorageVariableContents; type StoredItem = StorageVariableContents[T]; diff --git a/src/test/suite/editors/playgroundController.test.ts b/src/test/suite/editors/playgroundController.test.ts index 66af1b06b..0526aeb34 100644 --- a/src/test/suite/editors/playgroundController.test.ts +++ b/src/test/suite/editors/playgroundController.test.ts @@ -92,6 +92,7 @@ suite('Playground Controller Test Suite', function () { ); testParticipantController = new ParticipantController({ connectionController: testConnectionController, + storageController: testStorageController, }); testPlaygroundController = new PlaygroundController({ connectionController: testConnectionController, diff --git a/src/test/suite/editors/playgroundSelectedCodeActionProvider.test.ts b/src/test/suite/editors/playgroundSelectedCodeActionProvider.test.ts index 74f143249..07f9687d6 100644 --- a/src/test/suite/editors/playgroundSelectedCodeActionProvider.test.ts +++ b/src/test/suite/editors/playgroundSelectedCodeActionProvider.test.ts @@ -59,6 +59,7 @@ suite('Playground Selected CodeAction Provider Test Suite', function () { testParticipantController = new ParticipantController({ connectionController: testConnectionController, + storageController: testStorageController, }); sandbox.replace( diff --git a/src/test/suite/language/languageServerController.test.ts b/src/test/suite/language/languageServerController.test.ts index 52a660a37..3143f9c1b 100644 --- a/src/test/suite/language/languageServerController.test.ts +++ b/src/test/suite/language/languageServerController.test.ts @@ -71,6 +71,7 @@ suite('Language Server Controller Test Suite', () => { ); testParticipantController = new ParticipantController({ connectionController: testConnectionController, + storageController: testStorageController, }); testPlaygroundController = new PlaygroundController({ connectionController: testConnectionController, diff --git a/src/test/suite/views/webview-app/overview-page.test.tsx b/src/test/suite/views/webview-app/overview-page.test.tsx index 27b9b2c05..3dc9abbbf 100644 --- a/src/test/suite/views/webview-app/overview-page.test.tsx +++ b/src/test/suite/views/webview-app/overview-page.test.tsx @@ -39,7 +39,7 @@ describe('OverviewPage test suite', function () { describe('Connection Form', function () { // Rendering the connection form takes ~4 seconds, so we need to increase the timeout. // Not sure on the cause of this slowdown, it could be animation based. - this.timeout(10000); + this.timeout(20000); it('is able to open and close the new connection form', async function () { render();