feat: change prompt
This commit is contained in:
@@ -391,11 +391,11 @@ local function run_chatgpt_command()
|
||||
end
|
||||
|
||||
local initial_sections = {
|
||||
"### Basic Prompt Instructions:\n",
|
||||
"## Basic Prompt Instructions:\n",
|
||||
conf.initial_prompt .. "\n\n\n",
|
||||
"### User Instructions:\n",
|
||||
"## User Instructions:\n",
|
||||
user_input .. "\n\n\n",
|
||||
"### Context/Data:\n",
|
||||
"## Context/Data:\n",
|
||||
"Project name: " .. (conf.project_name or "") .. "\n",
|
||||
"Project Structure:\n",
|
||||
project_structure,
|
||||
@@ -403,7 +403,7 @@ local function run_chatgpt_command()
|
||||
}
|
||||
|
||||
if conf.enable_debug_commands then
|
||||
table.insert(initial_sections, "\n### Debug Commands Info:\n")
|
||||
table.insert(initial_sections, "\n## Debug Commands Info:\n")
|
||||
table.insert(initial_sections, prompts["debug-commands-info"])
|
||||
end
|
||||
|
||||
@@ -631,11 +631,11 @@ local function run_chatgpt_current_buffer_command()
|
||||
end
|
||||
|
||||
local initial_sections = {
|
||||
"### Basic Prompt Instructions:\n",
|
||||
"## Basic Prompt Instructions:\n",
|
||||
conf.initial_prompt .. "\n\n\n",
|
||||
"### User Instructions:\n",
|
||||
"## User Instructions:\n",
|
||||
user_input .. "\n\n\n",
|
||||
"### Context/Data:\n",
|
||||
"## Context/Data:\n",
|
||||
"Project name: " .. (conf.project_name or "") .. "\n",
|
||||
"Project Structure:\n",
|
||||
project_structure,
|
||||
@@ -643,7 +643,7 @@ local function run_chatgpt_current_buffer_command()
|
||||
}
|
||||
|
||||
if conf.enable_debug_commands then
|
||||
table.insert(initial_sections, "\n### Debug Commands Info:\n")
|
||||
table.insert(initial_sections, "\n## Debug Commands Info:\n")
|
||||
table.insert(initial_sections, prompts["debug-commands-info"])
|
||||
end
|
||||
|
||||
|
||||
@@ -256,52 +256,54 @@ local M = {
|
||||
["basic-prompt"] = [[
|
||||
### Basic Prompt
|
||||
|
||||
1. **Analyze Required Files**:
|
||||
- Identify the files that need to be modified or created based on the task requirements.
|
||||
- Ensure all necessary files are included in the output YAML response.
|
||||
1. **Analyze Required Files**
|
||||
- Check the project structure (or any provided file list).
|
||||
- If you identify a file reference or function you do not have, **produce a YAML snippet** requesting that file’s content in full. For example:
|
||||
```yaml
|
||||
project_name: my_project
|
||||
files:
|
||||
- path: "relative/path/to/needed_file"
|
||||
```
|
||||
- Do not proceed with final changes if you lack the necessary file contents.
|
||||
- Always provide the entire file content when you do include a file.
|
||||
|
||||
2. **Request File Contents**:
|
||||
- Provide a detailed description of the changes needed for each file, including any new content or modifications.
|
||||
- Use clear and concise instructions to guide the implementation process.
|
||||
2. **Request File Contents**
|
||||
- For every file you need but don’t have, provide a short YAML snippet (like above) to retrieve it.
|
||||
- Ask any clarifying questions outside the YAML code block.
|
||||
|
||||
3. **Provide Output YAML**:
|
||||
|
||||
- Structure your changes using the following format:
|
||||
3. **Provide Output YAML**
|
||||
- When you have all information, output the final YAML in this format:
|
||||
```yaml
|
||||
project_name: my_project
|
||||
|
||||
files:
|
||||
- file: src/main.py
|
||||
- path: "src/main.py"
|
||||
content: |
|
||||
# Updated main function
|
||||
def main():
|
||||
print("Hello, World!")
|
||||
|
||||
- file: docs/README.md
|
||||
- path: "docs/README.md"
|
||||
delete: true
|
||||
```
|
||||
- Explanation of the Example:
|
||||
- `project_name` specifies the project's name.
|
||||
- The `files` section lists all affected files.
|
||||
- `file: src/main.py` contains new content for modification.
|
||||
- `file: docs/README.md` is marked for deletion with delete: true.
|
||||
- `project_name` must match the project’s configured name.
|
||||
- Each file item in `files` must have `path` and either `content` or `delete: true`.
|
||||
|
||||
4. **Explain Changes**:
|
||||
- Provide a brief explanation of the changes made below the YAML response.
|
||||
- Highlight any key decisions or reasoning behind the modifications.
|
||||
4. **Explain Changes**
|
||||
- After the final YAML, add a brief explanation of the modifications (outside the YAML).
|
||||
|
||||
5. **Iterate as Needed**:
|
||||
- If additional context or modifications are required, repeat the workflow steps to gather more information or make further changes.
|
||||
5. **Iterate as Needed**
|
||||
- If further context or changes are required, repeat steps to request files or clarifications.
|
||||
|
||||
6. **Important Notes**:
|
||||
- Avoid using comments in the code to explain your thought process. Comments should only clarify the code itself.
|
||||
- You can explain your reasoning and decisions outside of the output YAML format.
|
||||
- Do not modify or delete any files that have not been explicitly requested.
|
||||
6. **Important Notes**
|
||||
- Never modify or delete a file you haven’t explicitly requested or received.
|
||||
- Use comments in code only to clarify code logic, not to explain your thought process.
|
||||
- Explanations go outside the YAML.
|
||||
|
||||
7. **Best Practices**:
|
||||
- Ensure all file paths and content are accurate to prevent errors during implementation.
|
||||
- Follow a logical structure for your changes to maintain readability and clarity.
|
||||
- Use `output YAML` consistently throughout the process for better clarity and understanding.
|
||||
7. **Best Practices**
|
||||
- Keep file paths accurate to avoid mistakes during implementation.
|
||||
- Maintain a clear, logical structure for your changes.
|
||||
- Use the final YAML consistently for clarity.
|
||||
]],
|
||||
["secure-coding"] = [[
|
||||
### Secure Coding Guidelines
|
||||
|
||||
Reference in New Issue
Block a user