fix: ensure there is no overlap between code snippets (#396)

This commit is contained in:
yetone
2024-08-30 20:43:26 +08:00
committed by GitHub
parent fc1bcda822
commit 5cf85d59bd
2 changed files with 58 additions and 7 deletions

View File

@@ -16,7 +16,7 @@ M.CANCEL_PATTERN = "AvanteLLMEscape"
-- Copy from: https://github.com/Doriandarko/claude-engineer/blob/15c94963cbf9d01b8ae7bbb5d42d7025aa0555d5/main.py#L276
---@alias AvanteBasePrompt string
local planning_mode_system_prompt_tpl = [[
You are an AI coding agent that generates code according to the instructions. Follow these steps:
You are an excellent programming expert and your primary task is to generate code according to the instructions. Follow these steps:
1. Review the entire file content to understand the context:
${file_content}
@@ -40,12 +40,12 @@ ${full_file_contents_context}
- Include enough context to uniquely identify the code to be changed
- Provide the exact replacement code, maintaining correct INDENTATION and FORMATTING
- Focus on specific, targeted changes rather than large, sweeping modifications
- The content in the SEARCH tag MUST NOT contain any of your generated content
- The content in the SEARCH tag MUST NOT contain any of your generated content. Do not be lazy!
- The content in the SEARCH tag MUST be based on the original content of the source file
- The content in the SEARCH tag needs to ensure a certain context to guarantee its UNIQUENESS
- The content in the REPLACE tag should also correspond to the context of the SEARCH tag
- There should be NO OVERLAP between the code of each SEARCH tag.
- DO NOT use ``` to wrap code blocks
- There should be NO OVERLAP between the code of each SEARCH tag. Do not be lazy!
- Be sure to ensure that there are NO SYNTAX ERRORS OR FORMATTING ERRORS after the SEARCH part in the source code is replaced by the REPLACE part! Do not be lazy!
- DO NOT use ``` to wrap code blocks, Do not be lazy!
8. Ensure that your SEARCH/REPLACE blocks:
- Address all relevant aspects of the instructions
@@ -69,7 +69,7 @@ If no changes are needed, return an empty list.
]]
local editing_mode_system_prompt_tpl = [[
You are an AI coding agent that generates code according to the instructions. Follow these steps:
You are an excellent programming expert and your primary task is to generate code according to the instructions. Follow these steps:
1. Review the entire file content to understand the context:
${file_content}