default prompt file

This commit is contained in:
Nate 2024-11-06 11:36:31 -08:00
parent 4cbf0592e4
commit 46bb3a57a9
2 changed files with 14 additions and 2 deletions

View file

@ -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);
}

View file

@ -14,6 +14,7 @@ export type GlobalContextType = {
*/
curEmbeddingsProviderId: EmbeddingsProvider["id"];
hasDismissedConfigTsNoticeJetBrains: boolean;
hasAlreadyCreatedAPromptFile: boolean;
};
/**