From bd1fc32f1c4ec8923a584acda77ae4df09a75e48 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Thu, 27 Jun 2024 14:39:22 +0200 Subject: [PATCH] #823 - Copilot setting --- package.json | 5 +++++ package.nls.json | 3 ++- src/constants/settings.ts | 2 ++ src/localization/localization.enum.ts | 2 +- src/services/Copilot.ts | 10 +++++++--- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3fb2e2c4..5ed9b50d 100644 --- a/package.json +++ b/package.json @@ -2034,6 +2034,11 @@ "info", "verbose" ] + }, + "frontMatter.copilot.family": { + "type": "string", + "default": "gpt-3.5-turbo", + "markdownDescription": "%setting.frontMatter.copilot.family.markdownDescription%" } } }, diff --git a/package.nls.json b/package.nls.json index d6df3695..f3a9a0ce 100644 --- a/package.nls.json +++ b/package.nls.json @@ -279,5 +279,6 @@ "setting.frontMatter.taxonomy.contentTypes.items.properties.isSubContent.description": "Specify if the content type is sub content.", "setting.frontMatter.git.disableOnBranches.markdownDescription": "Specify the branches on which you want to disable the Git actions. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.disableonbranches) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.disableonbranches%22%5D)", - "setting.frontMatter.git.requiresCommitMessage.markdownDescription": "Specify if you want to require a commit message when publishing your changes for a specified branch. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.requirescommitmessage) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.requirescommitmessage%22%5D)" + "setting.frontMatter.git.requiresCommitMessage.markdownDescription": "Specify if you want to require a commit message when publishing your changes for a specified branch. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.requirescommitmessage) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.git.requirescommitmessage%22%5D)", + "setting.frontMatter.copilot.family.markdownDescription": "Specify the LLM family of the Copilot you want to use. [Docs](https://frontmatter.codes/docs/settings/overview#frontmatter.copilot.family) - [View in VS Code](command:simpleBrowser.show?%5B%22https://frontmatter.codes/docs/settings/overview%23frontmatter.copilot.family%22%5D)" } \ No newline at end of file diff --git a/src/constants/settings.ts b/src/constants/settings.ts index c1424792..9b2a1e83 100644 --- a/src/constants/settings.ts +++ b/src/constants/settings.ts @@ -115,6 +115,8 @@ export const SETTING_SNIPPETS_WRAPPER = 'snippets.wrapper.enabled'; export const SETTING_WEBSITE_URL = 'website.host'; +export const SETTING_COPILOT_FAMILY = 'copilot.family'; + export const SETTING_LOGGING = 'logging'; /** diff --git a/src/localization/localization.enum.ts b/src/localization/localization.enum.ts index e12b8ec9..871f0dc6 100644 --- a/src/localization/localization.enum.ts +++ b/src/localization/localization.enum.ts @@ -2321,7 +2321,7 @@ export enum LocalizationKey { */ helpersQuestionsContentTitleAiInputQuickPickAiSeparator = 'helpers.questions.contentTitle.aiInput.quickPick.ai.separator', /** - * GitHub Copilot generated title + * GitHub Copilot suggestions */ helpersQuestionsContentTitleAiInputQuickPickCopilotSeparator = 'helpers.questions.contentTitle.aiInput.quickPick.copilot.separator', /** diff --git a/src/services/Copilot.ts b/src/services/Copilot.ts index 9bce7450..a3a5d330 100644 --- a/src/services/Copilot.ts +++ b/src/services/Copilot.ts @@ -7,7 +7,11 @@ import { version as VscodeVersion } from 'vscode'; import { Logger, Settings, TaxonomyHelper } from '../helpers'; -import { SETTING_SEO_DESCRIPTION_LENGTH, SETTING_SEO_TITLE_LENGTH } from '../constants'; +import { + SETTING_COPILOT_FAMILY, + SETTING_SEO_DESCRIPTION_LENGTH, + SETTING_SEO_TITLE_LENGTH +} from '../constants'; import { TagType } from '../panelWebView/TagType'; import { TaxonomyType } from '../models'; @@ -198,8 +202,8 @@ export class Copilot { */ private static async getModel() { const [model] = await lm.selectChatModels({ - vendor: 'copilot' - // family: 'gpt-4' + vendor: 'copilot', + family: Settings.get(SETTING_COPILOT_FAMILY) || 'gpt-3.5-turbo' }); return model;