From c1dbc965edd54b1303e7bc67e88a4784b0451f68 Mon Sep 17 00:00:00 2001 From: Logan Yang Date: Thu, 10 Jul 2025 16:25:31 -0700 Subject: [PATCH] Exclude copilot folders from indexing by default (#1621) --- src/constants.ts | 10 +++++++--- src/search/searchUtils.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 3b96a1d0..7d5efed6 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -9,6 +9,10 @@ export const BREVILABS_API_BASE_URL = "https://api.brevilabs.com/v1"; export const CHAT_VIEWTYPE = "copilot-chat-view"; export const USER_SENDER = "user"; export const AI_SENDER = "ai"; + +// Default folder names +export const DEFAULT_CHAT_HISTORY_FOLDER = "copilot-conversations"; +export const DEFAULT_CUSTOM_PROMPTS_FOLDER = "copilot-custom-prompts"; export const DEFAULT_SYSTEM_PROMPT = `You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking. 1. Never mention that you do not have access to something. Always rely on the user provided context. 2. Always answer to the best of your knowledge. If you are unsure about something, say so and ask the user to provide more context. @@ -665,14 +669,14 @@ export const DEFAULT_SETTINGS: CopilotSettings = { openAIProxyBaseUrl: "", openAIEmbeddingProxyBaseUrl: "", stream: true, - defaultSaveFolder: "copilot-conversations", + defaultSaveFolder: DEFAULT_CHAT_HISTORY_FOLDER, defaultConversationTag: "copilot-conversation", autosaveChat: false, includeActiveNoteAsContext: true, defaultOpenArea: DEFAULT_OPEN_AREA.VIEW, - customPromptsFolder: "copilot-custom-prompts", + customPromptsFolder: DEFAULT_CUSTOM_PROMPTS_FOLDER, indexVaultToVectorStore: VAULT_VECTOR_STORE_STRATEGY.ON_MODE_SWITCH, - qaExclusions: "", + qaExclusions: `${DEFAULT_CHAT_HISTORY_FOLDER},${DEFAULT_CUSTOM_PROMPTS_FOLDER}`, qaInclusions: "", chatNoteContextPath: "", chatNoteContextTags: [], diff --git a/src/search/searchUtils.ts b/src/search/searchUtils.ts index 4111fc73..dc4cc59e 100644 --- a/src/search/searchUtils.ts +++ b/src/search/searchUtils.ts @@ -70,7 +70,7 @@ export function getDecodedPatterns(value: string): string[] { } /** - * Get the exclusion patterns the exclusion settings string. + * Get the exclusion patterns from the exclusion settings string. * @returns An array of exclusion patterns. */ function getExclusionPatterns(): string[] {