fix: strengthen default Apply prompt for local models (#10486)

Local models respond to the existing single-sentence Apply prompt with
prose summaries instead of code. Return ChatMessage[] with explicit
code-only instructions and assistant prefill to force code output.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shanevcantwell 2026-03-20 17:33:09 -06:00 • committed by GitHub
parent df98f99976
commit f1a2fbfb10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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`,
},
];
};