more reliable gpt-4o edit prompt

This commit is contained in:
Nate 2024-08-27 21:14:57 -07:00
parent 2bd6b40ead
commit 246dc614be
2 changed files with 6 additions and 4 deletions

View file

@ -5,7 +5,7 @@ export enum IndexResultType {
Delete = "del",
AddTag = "addTag",
RemoveTag = "removeTag",
UpdateLastUpdated = "updateLastUpdated"
UpdateLastUpdated = "updateLastUpdated",
}
export type MarkCompleteCallback = (

View file

@ -25,9 +25,11 @@ const gptEditPrompt: PromptTemplate = (_, otherData) => {
${otherData.prefix}[BLANK]${otherData.codeToEdit}${otherData.suffix}
\`\`\`
Given the user's request: "${otherData.userInput}"
Above is the file of code that the user is currently editing in. Their cursor is located at the "[BLANK]". They have requested that you fill in the "[BLANK]" with code that satisfies the following request:
Here is the code that should fill in the [BLANK]:`;
"${otherData.userInput}"
Please generate this code. Your output will be only the code that should replace the "[BLANK]", without repeating any of the prefix or suffix, without any natural language explanation, and without messing up indentation. Here is the code that will replace the "[BLANK]":`;
}
const paragraphs = [
@ -74,7 +76,7 @@ const osModelsEditPrompt: PromptTemplate = (history, otherData) => {
!firstCharOfFirstLine;
const suffixTag = isSuffix ? "<STOP EDITING HERE>" : "";
const suffixExplanation = isSuffix
? " When you get to \"<STOP EDITING HERE>\", end your response."
? ' When you get to "<STOP EDITING HERE>", end your response.'
: "";
// If neither prefilling nor /v1/completions are supported, we have to use a chat prompt without putting words in the model's mouth