From 46bb3a57a9dd10451ae59e5fd73ee3e041982377 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 6 Nov 2024 11:36:31 -0800 Subject: [PATCH] default prompt file --- core/promptFiles/v2/createNewPromptFile.ts | 15 +++++++++++++-- core/util/GlobalContext.ts | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/promptFiles/v2/createNewPromptFile.ts b/core/promptFiles/v2/createNewPromptFile.ts index e334a5085..5813533ed 100644 --- a/core/promptFiles/v2/createNewPromptFile.ts +++ b/core/promptFiles/v2/createNewPromptFile.ts @@ -1,8 +1,9 @@ import path from "path"; import { IDE } from "../.."; +import { GlobalContext } from "../../util/GlobalContext"; import { DEFAULT_PROMPTS_FOLDER_V2 } from "./getPromptFiles"; -const DEFAULT_PROMPT_FILE = `# This is an example ".prompt" file +const FIRST_TIME_DEFAULT_PROMPT_FILE = `# This is an example ".prompt" file # It is used to define and reuse prompts within Continue # Continue will automatically create a context provider for each prompt in the .prompts folder # To learn more, see the full .prompt file reference: https://docs.continue.dev/features/prompt-files @@ -14,6 +15,11 @@ version: 2 Please reference the above README.md file to understand the current project. `; +const DEFAULT_PROMPT_FILE = `version: 2 +--- + +`; + export async function createNewPromptFileV2( ide: IDE, promptPath: string | undefined, @@ -30,6 +36,11 @@ export async function createNewPromptFileV2( "new-prompt-file.prompt", ); - await ide.writeFile(promptFilePath, DEFAULT_PROMPT_FILE); + const PROMPT_FILE = + new GlobalContext().get("hasAlreadyCreatedAPromptFile") === true + ? DEFAULT_PROMPT_FILE + : FIRST_TIME_DEFAULT_PROMPT_FILE; + + await ide.writeFile(promptFilePath, PROMPT_FILE); await ide.openFile(promptFilePath); } diff --git a/core/util/GlobalContext.ts b/core/util/GlobalContext.ts index f48e848a9..097dac5d1 100644 --- a/core/util/GlobalContext.ts +++ b/core/util/GlobalContext.ts @@ -14,6 +14,7 @@ export type GlobalContextType = { */ curEmbeddingsProviderId: EmbeddingsProvider["id"]; hasDismissedConfigTsNoticeJetBrains: boolean; + hasAlreadyCreatedAPromptFile: boolean; }; /**