diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e57b8d5..b34d2fbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [10.10.0] - 2025-xx-xx +- Removed the chatbot command and all related code and references - [#983](https://github.com/estruyf/vscode-front-matter/issues/983): Removal of the `frontMatter.sponsors.ai.enabled` features ### 🎨 Enhancements diff --git a/package.json b/package.json index 79ea6a48..3c57897b 100644 --- a/package.json +++ b/package.json @@ -2385,15 +2385,6 @@ "category": "Front Matter", "icon": "$(book)" }, - { - "command": "frontMatter.chatbot", - "title": "%command.frontMatter.chatbot%", - "category": "Front Matter", - "icon": { - "light": "assets/icons/chatbot-light.svg", - "dark": "assets/icons/chatbot-dark.svg" - } - }, { "command": "frontMatter.promoteSettings", "title": "%command.frontMatter.promoteSettings%", @@ -2560,11 +2551,6 @@ "command": "frontMatter.dashboard.close", "group": "navigation@-98", "when": "frontMatter:enabled == true && frontMatter:dashboard:open == true" - }, - { - "command": "frontMatter.chatbot", - "group": "navigation@-97", - "when": "resourceFilename == 'frontmatter.json'" } ], "explorer/context": [ @@ -2774,11 +2760,6 @@ "group": "navigation@-1", "when": "view == frontMatter.explorer" }, - { - "command": "frontMatter.chatbot", - "group": "navigation@0", - "when": "view == frontMatter.explorer" - }, { "command": "frontMatter.mode.switch", "group": "navigation@1", diff --git a/src/commands/Chatbot.ts b/src/commands/Chatbot.ts deleted file mode 100644 index ba1e616f..00000000 --- a/src/commands/Chatbot.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { PreviewCommands, GeneralCommands } from './../constants'; -import { join } from 'path'; -import { commands, Uri, ViewColumn, window } from 'vscode'; -import { Extension } from '../helpers'; -import { WebviewHelper } from '@estruyf/vscode'; -import { getLocalizationFile } from '../utils/getLocalizationFile'; -import * as l10n from '@vscode/l10n'; -import { LocalizationKey } from '../localization'; -import { getWebviewJsFiles } from '../utils'; - -export class Chatbot { - /** - * Open the Chatbot in the editor - */ - public static async open(extensionPath: string) { - // Create the preview webview - const webView = window.createWebviewPanel( - 'frontMatterChatbot', - `Front Matter AI - ${l10n.t(LocalizationKey.commandsChatbotTitle)}`, - { - viewColumn: ViewColumn.Beside, - preserveFocus: true - }, - { - enableScripts: true - } - ); - - webView.iconPath = { - dark: Uri.file(join(extensionPath, 'assets/icons/frontmatter-short-dark.svg')), - light: Uri.file(join(extensionPath, 'assets/icons/frontmatter-short-light.svg')) - }; - - const cspSource = webView.webview.cspSource; - - const fetchLocalization = async (requestId: string) => { - if (!requestId) { - return; - } - - const fileContents = await getLocalizationFile(); - - webView.webview.postMessage({ - command: GeneralCommands.toVSCode.getLocalization, - requestId, - payload: fileContents - }); - }; - - webView.webview.onDidReceiveMessage(async (message) => { - const { command, requestId, payload, data } = message; - - switch (command) { - case PreviewCommands.toVSCode.open: - if (payload || data) { - commands.executeCommand('vscode.open', payload || data); - } - break; - case GeneralCommands.toVSCode.getLocalization: - fetchLocalization(requestId); - return; - } - }); - - const webviewFile = 'dashboard.main.js'; - const localPort = `9000`; - const localServerUrl = `localhost:${localPort}`; - - const nonce = WebviewHelper.getNonce(); - - const ext = Extension.getInstance(); - const isProd = ext.isProductionMode; - const version = ext.getVersion(); - const isBeta = ext.isBetaVersion(); - - const csp = [ - `default-src 'none';`, - `img-src ${cspSource} http: https:;`, - `script-src ${ - isProd ? `'nonce-${nonce}'` : `http://${localServerUrl} http://0.0.0.0:${localPort}` - } 'unsafe-eval'`, - `style-src ${cspSource} 'self' 'unsafe-inline' http: https:`, - `connect-src https://* ${ - isProd - ? `` - : `ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort}` - }` - ]; - - let scriptUris = []; - if (isProd) { - scriptUris = await getWebviewJsFiles('dashboard', webView.webview); - } else { - scriptUris.push(`http://${localServerUrl}/${webviewFile}`); - } - - // By default, the chatbot is seen as experimental - const experimental = true; - - webView.webview.html = ` - - - - - - - - Front Matter Docs Chatbot - - -
- - ${scriptUris - .map((uri) => ``) - .join('\n')} - - Daily usage - - - `; - } -} diff --git a/src/commands/index.ts b/src/commands/index.ts index 0c29b985..4e3a0290 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,7 +1,6 @@ export * from './Article'; export * from './Backers'; export * from './Cache'; -export * from './Chatbot'; export * from './Content'; export * from './Dashboard'; export * from './Diagnostics'; diff --git a/src/constants/Extension.ts b/src/constants/Extension.ts index 47dec66e..d32b1e50 100644 --- a/src/constants/Extension.ts +++ b/src/constants/Extension.ts @@ -28,7 +28,6 @@ export const COMMAND_NAME = { collapseSections: getCommandName('collapseSections'), preview: getCommandName('preview'), docs: getCommandName('docs'), - chatbot: getCommandName('chatbot'), dashboard: getCommandName('dashboard'), dashboardMedia: getCommandName('dashboard.media'), dashboardSnippets: getCommandName('dashboard.snippets'), diff --git a/src/extension.ts b/src/extension.ts index 643615e6..f936c87c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -30,7 +30,6 @@ import { Article, Settings, StatusListener, - Chatbot, Taxonomy } from './commands'; import { join } from 'path'; @@ -200,11 +199,6 @@ export async function activate(context: vscode.ExtensionContext) { }) ); - // Chat to the bot - subscriptions.push( - vscode.commands.registerCommand(COMMAND_NAME.chatbot, () => Chatbot.open(extensionPath)) - ); - // Create the editor experience for bulk scripts subscriptions.push( vscode.workspace.registerTextDocumentContentProvider( diff --git a/src/localization/localization.enum.ts b/src/localization/localization.enum.ts index 312eda56..f7e334d4 100644 --- a/src/localization/localization.enum.ts +++ b/src/localization/localization.enum.ts @@ -339,38 +339,7 @@ export enum LocalizationKey { * Unknown field */ fieldUnknown = 'field.unknown', - /** - * Answer - */ - dashboardChatbotAnswerAnswer = 'dashboard.chatbot.answer.answer', - /** - * Resources - */ - dashboardChatbotAnswerResources = 'dashboard.chatbot.answer.resources', - /** - * Warning: Anwers might be wrong. In case of doubt, please consult the docs. - */ - dashboardChatbotAnswerWarning = 'dashboard.chatbot.answer.warning', - /** - * Assistent is getting ready - */ - dashboardChatbotChatbotLoading = 'dashboard.chatbot.chatbot.loading', - /** - * I'm ready, what do you want to know? - */ - dashboardChatbotChatbotReady = 'dashboard.chatbot.chatbot.ready', - /** - * How can I configure Front Matter? - */ - dashboardChatbotChatboxPlaceholder = 'dashboard.chatbot.chatbox.placeholder', - /** - * Ask Front Matter AI - */ - dashboardChatbotHeaderHeading = 'dashboard.chatbot.header.heading', - /** - * Our AI, powered by mendable.ai, has processed the documentation and can assist you with any queries regarding Front Matter. Go ahead and ask away! - */ - dashboardChatbotHeaderDescription = 'dashboard.chatbot.header.description', + /** * Open options */ @@ -1776,10 +1745,6 @@ export enum LocalizationKey { * Cache cleared */ commandsCacheCleared = 'commands.cache.cleared', - /** - * Ask me anything - */ - commandsChatbotTitle = 'commands.chatbot.title', /** * Create content by content type */