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:
parent
df98f99976
commit
f1a2fbfb10
1 changed files with 25 additions and 2 deletions
|
|
@ -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…
Add table
Reference in a new issue