Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"⚠️ **Security:** TLS/SSL Disabled": "⚠️ **Security:** TLS/SSL Disabled",
"⚠ TLS/SSL Disabled": "⚠ TLS/SSL Disabled",
"✅ **Security:** TLS/SSL Enabled": "✅ **Security:** TLS/SSL Enabled",
"🔍 Explain": "🔍 Explain",
"$(add) Create...": "$(add) Create...",
"$(info) Some storage accounts were filtered because of their sku. Learn more...": "$(info) Some storage accounts were filtered because of their sku. Learn more...",
"$(keyboard) Manually enter error": "$(keyboard) Manually enter error",
Expand All @@ -42,6 +43,9 @@
"An element with the following id already exists: {id}": "An element with the following id already exists: {id}",
"An error has occurred. Check output window for more details.": "An error has occurred. Check output window for more details.",
"An item with id \"{0}\" already exists for workspace \"{1}\".": "An item with id \"{0}\" already exists for workspace \"{1}\".",
"API key from Azure portal": "API key from Azure portal",
"API key is required": "API key is required",
"API key seems too short": "API key seems too short",
"API version \"{0}\" for extension id \"{1}\" is no longer supported. Minimum version is \"{2}\".": "API version \"{0}\" for extension id \"{1}\" is no longer supported. Minimum version is \"{2}\".",
"API: Registered new migration provider: \"{providerId}\" - \"{providerLabel}\"": "API: Registered new migration provider: \"{providerId}\" - \"{providerLabel}\"",
"Are you sure?": "Are you sure?",
Expand All @@ -53,6 +57,8 @@
"Azure Activity": "Azure Activity",
"Azure Cosmos DB for MongoDB (RU) Emulator": "Azure Cosmos DB for MongoDB (RU) Emulator",
"Azure Cosmos DB for MongoDB (vCore)": "Azure Cosmos DB for MongoDB (vCore)",
"Azure OpenAI": "Azure OpenAI",
"Azure OpenAI endpoint is required": "Azure OpenAI endpoint is required",
"Azure Service Discovery": "Azure Service Discovery",
"Azure VM Service Discovery": "Azure VM Service Discovery",
"Azure VM: Attempting to authenticate with \"{vmName}\"…": "Azure VM: Attempting to authenticate with \"{vmName}\"…",
Expand Down Expand Up @@ -81,6 +87,8 @@
"Collection name is required.": "Collection name is required.",
"Collection names should begin with an underscore or a letter character.": "Collection names should begin with an underscore or a letter character.",
"Configure Azure VM Discovery Filters": "Configure Azure VM Discovery Filters",
"Configure LLM": "Configure LLM",
"Configure LLM Resource": "Configure LLM Resource",
"Configure TLS/SSL Security": "Configure TLS/SSL Security",
"Connect to a database": "Connect to a database",
"Connected to \"{cluster}\" as \"{username}\"": "Connected to \"{cluster}\" as \"{username}\"",
Expand Down Expand Up @@ -138,9 +146,11 @@
"Edit selected document": "Edit selected document",
"Element with id of {rootId} not found.": "Element with id of {rootId} not found.",
"Enable TLS/SSL (Default)": "Enable TLS/SSL (Default)",
"Endpoint must use HTTPS": "Endpoint must use HTTPS",
"Enforce TLS/SSL checks for a secure connection.": "Enforce TLS/SSL checks for a secure connection.",
"Enter a collection name.": "Enter a collection name.",
"Enter a database name.": "Enter a database name.",
"Enter OpenAI API endpoint (leave empty for default)": "Enter OpenAI API endpoint (leave empty for default)",
"Enter the Azure VM tag key used for discovering DocumentDB instances.": "Enter the Azure VM tag key used for discovering DocumentDB instances.",
"Enter the Azure VM tag to filter by": "Enter the Azure VM tag to filter by",
"Enter the connection string of your local connection": "Enter the connection string of your local connection",
Expand All @@ -151,6 +161,9 @@
"Enter the port number your DocumentDB uses. The default port: {defaultPort}.": "Enter the port number your DocumentDB uses. The default port: {defaultPort}.",
"Enter the username": "Enter the username",
"Enter the username for {experience}": "Enter the username for {experience}",
"Enter your Azure OpenAI API key": "Enter your Azure OpenAI API key",
"Enter your Azure OpenAI endpoint URL": "Enter your Azure OpenAI endpoint URL",
"Enter your OpenAI API key": "Enter your OpenAI API key",
"Error creating resource: {0}": "Error creating resource: {0}",
"Error deleting selected documents": "Error deleting selected documents",
"Error exporting documents: {error}": "Error exporting documents: {error}",
Expand All @@ -172,6 +185,7 @@
"Execution timed out.": "Execution timed out.",
"Expected a file name \"{0}\", but the selected filename is \"{1}\"": "Expected a file name \"{0}\", but the selected filename is \"{1}\"",
"Expecting parentheses or quotes at \"{text}\"": "Expecting parentheses or quotes at \"{text}\"",
"Explaining the command…": "Explaining the command…",
"Export": "Export",
"Export Current Query Results…": "Export Current Query Results…",
"Export Entire Collection…": "Export Entire Collection…",
Expand Down Expand Up @@ -205,13 +219,16 @@
"failed.": "failed.",
"Find Query": "Find Query",
"Finished importing": "Finished importing",
"Getting performance insights for database \"{0}\"…": "Getting performance insights for database \"{0}\"…",
"Go back.": "Go back.",
"Go to first page": "Go to first page",
"Go to next page": "Go to next page",
"Go to previous page": "Go to previous page",
"Go to start": "Go to start",
"Got a moment? Share your feedback on DocumentDB for VS Code!": "Got a moment? Share your feedback on DocumentDB for VS Code!",
"How do you want to connect?": "How do you want to connect?",
"https://api.openai.com/v1": "https://api.openai.com/v1",
"https://your-resource.openai.azure.com/": "https://your-resource.openai.azure.com/",
"I want to choose the server from an online registry.": "I want to choose the server from an online registry.",
"I want to connect to a local DocumentDB instance.": "I want to connect to a local DocumentDB instance.",
"I want to connect to the Azure Cosmos DB Emulator for MongoDB (RU).": "I want to connect to the Azure Cosmos DB Emulator for MongoDB (RU).",
Expand Down Expand Up @@ -254,6 +271,8 @@
"Learn more…": "Learn more…",
"Length must be greater than 1": "Length must be greater than 1",
"Level up": "Level up",
"LLM configuration saved successfully. Enhanced features are now available.": "LLM configuration saved successfully. Enhanced features are now available.",
"LLM Enhanced Features Not Available": "LLM Enhanced Features Not Available",
"Load More...": "Load More...",
"Loading \"{0}\"...": "Loading \"{0}\"...",
"Loading cluster details for \"{cluster}\"": "Loading cluster details for \"{cluster}\"",
Expand All @@ -266,6 +285,7 @@
"Loading...": "Loading...",
"Local Emulators": "Local Emulators",
"Location": "Location",
"Microsoft Azure OpenAI Service": "Microsoft Azure OpenAI Service",
"Mongo Shell connected.": "Mongo Shell connected.",
"Mongo Shell Error: {error}": "Mongo Shell Error: {error}",
"MongoDB Accounts": "MongoDB Accounts",
Expand All @@ -282,9 +302,12 @@
"No Azure subscription found for this tree item.": "No Azure subscription found for this tree item.",
"No Azure VMs found with tag \"{tagName}\" in subscription \"{subscriptionName}\".": "No Azure VMs found with tag \"{tagName}\" in subscription \"{subscriptionName}\".",
"No collection selected.": "No collection selected.",
"No command found at the current position.": "No command found at the current position.",
"No commands found in this document.": "No commands found in this document.",
"No Connectivity": "No Connectivity",
"No credentials found for id {credentialId}": "No credentials found for id {credentialId}",
"No database connection found.": "No database connection found.",
"No database selected.": "No database selected.",
"No matching resources found.": "No matching resources found.",
"No node selected.": "No node selected.",
"No properties found in the schema at path \"{0}\"": "No properties found in the schema at path \"{0}\"",
Expand All @@ -294,16 +317,21 @@
"No session found for id {sessionId}": "No session found for id {sessionId}",
"No subscriptions found": "No subscriptions found",
"Not connected to any MongoDB database.": "Not connected to any MongoDB database.",
"Not Now": "Not Now",
"Note: This confirmation type can be configured in the extension settings.": "Note: This confirmation type can be configured in the extension settings.",
"Note: You can disable these URL handling confirmations in the extension settings.": "Note: You can disable these URL handling confirmations in the extension settings.",
"Open Collection": "Open Collection",
"Open installation page": "Open installation page",
"OpenAI": "OpenAI",
"OpenAI API": "OpenAI API",
"OpenAI API key should start with \"sk-\"": "OpenAI API key should start with \"sk-\"",
"Opening DocumentDB connection…": "Opening DocumentDB connection…",
"Operation cancelled.": "Operation cancelled.",
"Password for {username_at_resource}": "Password for {username_at_resource}",
"Pick \"{number}\" to confirm and continue.": "Pick \"{number}\" to confirm and continue.",
"Please authenticate first by expanding the tree item of the selected cluster.": "Please authenticate first by expanding the tree item of the selected cluster.",
"Please confirm by re-entering the previous value.": "Please confirm by re-entering the previous value.",
"Please connect to a MongoDB database before explaining a command.": "Please connect to a MongoDB database before explaining a command.",
"Please connect to a MongoDB database before running a Scrapbook command.": "Please connect to a MongoDB database before running a Scrapbook command.",
"Please edit the connection string.": "Please edit the connection string.",
"Please enter a new connection name.": "Please enter a new connection name.",
Expand All @@ -318,6 +346,8 @@
"Process exited: \"{command}\"": "Process exited: \"{command}\"",
"Provide Feedback": "Provide Feedback",
"Provider \"{0}\" does not have resource type \"{1}\".": "Provider \"{0}\" does not have resource type \"{1}\".",
"Provider and API key are required": "Provider and API key are required",
"Provider must be selected first": "Provider must be selected first",
"Refresh": "Refresh",
"Refresh current view": "Refresh current view",
"Registering Providers...": "Registering Providers...",
Expand All @@ -344,6 +374,7 @@
"Select a location for new resources.": "Select a location for new resources.",
"Select a workspace folder": "Select a workspace folder",
"Select Existing": "Select Existing",
"Select LLM provider": "Select LLM provider",
"Select resource": "Select resource",
"Select subscription": "Select subscription",
"Select Subscriptions": "Select Subscriptions",
Expand All @@ -355,6 +386,7 @@
"Sign In": "Sign In",
"Sign in to Azure...": "Sign in to Azure...",
"Signing out programmatically is not supported. You must sign out by selecting the account in the Accounts menu and choosing Sign Out.": "Signing out programmatically is not supported. You must sign out by selecting the account in the Accounts menu and choosing Sign Out.",
"sk-...": "sk-...",
"Skip for now": "Skip for now",
"Small breadcrumb example with buttons": "Small breadcrumb example with buttons",
"Some items could not be displayed": "Some items could not be displayed",
Expand Down Expand Up @@ -413,6 +445,7 @@
"This operation is not supported.": "This operation is not supported.",
"This table view presents data at the root level by default.": "This table view presents data at the root level by default.",
"Timed out trying to execute the Mongo script. To use a longer timeout, modify the VS Code 'mongo.shell.timeout' setting.": "Timed out trying to execute the Mongo script. To use a longer timeout, modify the VS Code 'mongo.shell.timeout' setting.",
"To use enhanced features powered by AI, you need to configure an LLM resource (Azure OpenAI or OpenAI). Would you like to configure it now?": "To use enhanced features powered by AI, you need to configure an LLM resource (Azure OpenAI or OpenAI). Would you like to configure it now?",
"TODO: Share the steps needed to reliably reproduce the problem. Please include actual and expected results.": "TODO: Share the steps needed to reliably reproduce the problem. Please include actual and expected results.",
"Too many arguments. Expecting 0 or 1 argument(s) to {constructorCall}": "Too many arguments. Expecting 0 or 1 argument(s) to {constructorCall}",
"Tree View": "Tree View",
Expand Down Expand Up @@ -467,6 +500,7 @@
"You clicked a link that wants to open a DocumentDB connection in VS Code.": "You clicked a link that wants to open a DocumentDB connection in VS Code.",
"You do not have permission to create a resource group in subscription \"{0}\".": "You do not have permission to create a resource group in subscription \"{0}\".",
"You might be asked for credentials to establish the connection.\nDo you want to continue?\n\nNote: You can disable these URL handling confirmations in the extension settings.": "You might be asked for credentials to establish the connection.\nDo you want to continue?\n\nNote: You can disable these URL handling confirmations in the extension settings.",
"You must open a *.vscode-documentdb-scrapbook file to explain commands.": "You must open a *.vscode-documentdb-scrapbook file to explain commands.",
"You must open a *.vscode-documentdb-scrapbook file to run commands.": "You must open a *.vscode-documentdb-scrapbook file to run commands.",
"You need to provide the password for \"{username}\" in order to continue. Your password will not be stored.": "You need to provide the password for \"{username}\" in order to continue. Your password will not be stored.",
"Your database stores documents with embedded fields, allowing for hierarchical data organization.": "Your database stores documents with embedded fields, allowing for hierarchical data organization.",
Expand Down
49 changes: 48 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,25 @@
"command": "vscode-documentdb.command.createDatabase",
"title": "Create Database…"
},
{
"//": "Performance Insight",
"category": "DocumentDB",
"command": "vscode-documentdb.command.performanceInsight",
"title": "Performance Insight"
},
{
"//": "Configure LLM Resource",
"category": "DocumentDB",
"command": "vscode-documentdb.command.configureLlm",
"title": "Configure LLM Resource…",
"icon": "$(settings-gear)"
},
{
"//": "Scrapbook: Explain Command",
"category": "DocumentDB",
"command": "vscode-documentdb.command.scrapbook.explainCommand",
"title": "Explain Command"
},
{
"//": "Scrapbook: Connect Database",
"category": "DocumentDB",
Expand Down Expand Up @@ -605,11 +624,17 @@
"when": "view =~ /connectionsView|discoveryView/ && viewItem =~ /treeitem[.]database(?![a-z.\\/])/i && viewItem =~ /experience[.](mongocluster|mongodb)/i",
"group": "2@1"
},
{
"//": "[Database] Performance Insight",
"command": "vscode-documentdb.command.performanceInsight",
"when": "view =~ /connectionsView|discoveryView/ && viewItem =~ /treeitem[.]database(?![a-z.\\/])/i && viewItem =~ /experience[.](mongocluster|mongodb)/i",
"group": "2@2"
},
{
"//": "[Database] Mongo DB|Cluster Scrapbook Submenu",
"submenu": "documentDB.submenus.mongo.database.scrapbook",
"when": "view =~ /connectionsView|discoveryView/ && viewItem =~ /treeitem[.]database(?![a-z.\\/])/i && viewItem =~ /experience[.](mongocluster|mongodb)/i",
"group": "2@2"
"group": "2@3"
},
{
"//": "[Collection] Mongo DB|Cluster Open collection",
Expand Down Expand Up @@ -862,6 +887,28 @@
"type": "number",
"description": "The batch size to be used when querying working with the shell.",
"default": 50
},
"documentDB.llm.provider": {
"order": 30,
"type": "string",
"description": "The LLM provider to use for enhanced features (Azure OpenAI or OpenAI).",
"enum": [
"",
"azure-openai",
"openai"
],
"enumItemLabels": [
"Not Configured",
"Azure OpenAI",
"OpenAI"
],
"default": ""
},
"documentDB.llm.endpoint": {
"order": 31,
"type": "string",
"description": "The endpoint URL for the LLM service (required for Azure OpenAI, optional for OpenAI).",
"default": ""
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/commands/configureLlm/ConfigureLlmWizardContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { type IActionContext } from '@microsoft/vscode-azext-utils';
import { type LlmProvider } from '../../services/LlmConfigurationService';

export interface ConfigureLlmWizardContext extends IActionContext {
provider?: LlmProvider;
endpoint?: string;
apiKey?: string;
}
36 changes: 36 additions & 0 deletions src/commands/configureLlm/ExecuteStep.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardExecuteStep } from '@microsoft/vscode-azext-utils';
import * as l10n from '@vscode/l10n';
import * as vscode from 'vscode';
import { LlmConfigurationService } from '../../services/LlmConfigurationService';
import { type ConfigureLlmWizardContext } from './ConfigureLlmWizardContext';

export class ExecuteStep extends AzureWizardExecuteStep<ConfigureLlmWizardContext> {
public priority: number = 100;

public async execute(context: ConfigureLlmWizardContext): Promise<void> {
if (!context.provider || !context.apiKey) {
throw new Error(l10n.t('Provider and API key are required'));
}

const llmService = LlmConfigurationService.getInstance();

await llmService.setConfiguration({
provider: context.provider,
endpoint: context.endpoint,
apiKey: context.apiKey,
});

void vscode.window.showInformationMessage(
l10n.t('LLM configuration saved successfully. Enhanced features are now available.')
);
}

public shouldExecute(context: ConfigureLlmWizardContext): boolean {
return !!context.provider && !!context.apiKey;
}
}
Loading
Loading