diff --git a/core/llm/constructMessages.ts b/core/llm/constructMessages.ts index 8a6382ca4..ca3bdf1f9 100644 --- a/core/llm/constructMessages.ts +++ b/core/llm/constructMessages.ts @@ -24,31 +24,31 @@ export const DEFAULT_CHAT_SYSTEM_MESSAGE = `\ unmodified sections. For example: \`\`\`language /path/to/file - // ... rest of code here ... + // ... existing code ... {{ modified code here }} - // ... rest of code here ... + // ... existing code ... {{ another modification }} - // ... rest of code here ... + // ... rest of code ... \`\`\` In existing files, you should always restate the function or class that the snippet belongs to: \`\`\`language /path/to/file - // ... rest of code here ... + // ... existing code ... function exampleFunction() { - // ... rest of code here ... + // ... existing code ... {{ modified code here }} - // ... rest of code here ... + // ... rest of function ... } - // ... rest of code here ... + // ... rest of code ... \`\`\` Since users have access to their complete file, they prefer reading only the @@ -100,7 +100,8 @@ export function constructMessages( | undefined; const systemMessage = getSystemMessageWithRules({ - baseSystemMessage: baseChatOrAgentSystemMessage ?? DEFAULT_CHAT_SYSTEM_MESSAGE, + baseSystemMessage: + baseChatOrAgentSystemMessage ?? DEFAULT_CHAT_SYSTEM_MESSAGE, rules, userMessage: lastUserMsg, }); diff --git a/core/tools/definitions/editFile.ts b/core/tools/definitions/editFile.ts index 9e2d60219..1653cb279 100644 --- a/core/tools/definitions/editFile.ts +++ b/core/tools/definitions/editFile.ts @@ -30,7 +30,7 @@ export const editFileTool: Tool = { changes: { type: "string", description: - "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock. Use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... rest of code here ...'", + "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock or write anything besides the code changes. In larger files, use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... existing code ...'", }, }, },