Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions core/llm/templates/edit/gpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,31 @@ export const gptEditPrompt: PromptTemplateFunction = (history, otherData) => {
};

export const defaultApplyPrompt: PromptTemplateFunction = (
history,
_history,
otherData,
) => {
return `${otherData.original_code}\n\nThe following code was suggested as an edit:\n\`\`\`\n${otherData.new_code}\n\`\`\`\nPlease apply it to the previous code. Leave existing comments in place unless changes require modifying them.`;
return [
{
role: "user",
content: dedent`
ORIGINAL CODE:
\`\`\`
${otherData.original_code}
\`\`\`

SUGGESTED EDIT:
\`\`\`
${otherData.new_code}
\`\`\`

Apply the SUGGESTED EDIT to the ORIGINAL CODE. Output the complete modified file.
- Output ONLY code. Do NOT explain, summarize, or describe changes.
- Leave existing comments in place unless changes require modifying them.
- Preserve all unchanged code exactly as-is.`,
},
{
role: "assistant",
content: `\`\`\`\n`,
},
];
};
Loading